用HTML5寫一個簡單的HTML頁面

來源:互聯網
上載者:User

標籤:

HTML5的<!doctype>聲明

 

在HTML 4.01中doctype這樣寫:

<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

在HTML5中很簡單:

<!DOCTYPE html>

 

HTML5的<meta>標籤

 

<meta>標籤在 HTML 4.01 中這樣寫:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

在HTML5中也很簡單:

<meta charset="UTF-8">

meta標籤的常見功能:

  • 協助首頁被各大搜尋引擎登入
<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript" />

  • 定義對頁面的描述
<meta name="description" content="程式員,Python程式員," />

 

HTML5 <head>標籤

 

head 元素可包含關於文檔的資訊。瀏覽器不會向使用者顯示這些頭部資訊("head information")。下面這些標籤可用在 head 部分:<base>, <link>, <meta>, <script>, <style>, 以及 <title>。

 

雅虎工程師提供的CSS初始化範例程式碼

 

可以在html標頭檔中直接引用,從而避免瀏覽器的不相容帶來的錯誤。

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { margin:0; padding:0; }
body { background:#fff; color:#555; font-size:14px; font-family: Verdana, Arial, Helvetica, sans-serif; }
td,th,caption { font-size:14px; }
h1, h2, h3, h4, h5, h6 { font-weight:normal; font-size:100%; }
address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal;}
a { color:#555; text-decoration:none; }
a:hover { text-decoration:underline; }
img { border:none; }
ol,ul,li { list-style:none; }
input, textarea, select, button { font:14px Verdana,Helvetica,Arial,sans-serif; }
table { border-collapse:collapse; }
html {overflow-y: scroll;}

.clearfix:after {content: "."; display: block; height:0; clear:both; visibility: hidden;}
.clearfix { *zoom:1; }

 

Hello HTML5:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>這是一個HTML5的網頁</title>
</head>
<body>
<p>Hello HTML5</p>
</body>
</html>


 

用HTML5寫一個簡單的HTML頁面

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.