这一节课是这样讲解DOM的:
- Basis of HTML5 is "New features should be based on HTML,CSS,the DOM, and JavaScript..." H5的新特征基于HTML,CSS,DOM和Javascript.
- DOM provides common tree-like structure that all pages should follow. DOM提供了常见的树形结构,而所有网页都是按照该结构构成的.
- HTML is built on the DOM 直接放图:
结构良好的HTML应有如下组成部分(3个):
Every well-formed HTML document should include:
- Doctype <!DOCTYPE html> ( the only doctype for H5) Previous versions dictated backwards compatibility.
Head
meta data language,title
supporting files:JavaScript, Styling,Addons.
Body
The bulk of your page, it's important to write well-formatted(tree-like) code.
Most of the contents will be displayed by the brower, but there may be some meta-data which
hen you finish your code, you need to user validator to validate them.(搜 Markup Validation Service)
HTML5 Tags and Syntax
学习原则
It's really not until you need a tag that you ever really bother learning about it .()
Tag分类
Start tag<h1>,Closing tag</h1>,Self-closing tag <img src="x.gif"/> .
Some tags have attributes()
常见
<h1>-<h6> have syntax and semantics
<p> should only contain inline elements.
<div>的缺点:there is no semantic meaning behind a div.(Compared with "header" or "footer").
Attributes
作用 provide additional information about an element.
形式come in name/value pairs. (有了name就要有value,如有src就要有对应地址,)
Attributes that apply to any tag:
class/id/style/accesskey/tabindex(1 is the highest priority)
Special entities 特殊字符
> 和 >