首页 > 代码库 > HTML 5

HTML 5

1. New Declaration

In HTML 4.01, the <!DOCTYPE> declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.

HTML5 is not based on SGML, and therefore does not require a reference to a DTD.

<!DOCTYPE html>

2. HTML headings are defined with h1 to h6 tags.

3. HTML元素指的是从开始标签(start tag)到结束标签(end tag)的所有代码;

开始标签 元素内容 结束标签
<p> This is a paragraph </p>
<a href="http://www.mamicode.com/default.htm" > This is a link </a>
<br />    

4. <a>标签的新属性:download,可以指定用户点击链接时下载某个文件,也可以默认下载href属性中的链接地址;

5. <a>标签的target属性:新标签页,当前frame,父级frame,整个body,或者指定的frame下;

<a target="_blank|_self|_parent|_top|framename">

6. <img>标签的alt属性用于指定在图片不能显示时的替代文字(在IE7及以前的版本中,alt属性被作为tooltip(提示框)显示出来,这种行为是错误的,应该使用title属性来显示图片的提示信息)。

7. <map> --><area>的coords属性的坐标值是对于整个页面而言的,“0,0”就是页面左上角,坐标顺序是左上右下(x1,y1,x2,y2);

8. margin属性的顺序是上右下左,例如:“margin: 10 0 20 50;" 意思是margin-left是50px,margin-top是10px;

9. <abbr>标签用于显示缩写词

<p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948</p>

鼠标放在“WHO”上就可以看到

10.