What is HTML?
HTML is a markup language for describing web pages. 它是一种用于描述网页的标记语言。
- HTML stands for Hyper Text Markup Language, a markup language is a set ofmarkup tags
- HTML tags describe document content 标签描述了HTML文件的内容
- HTML documents contain HTML tags and plain text, are also called web pages(HTML 文件也被称作网页,由标签和纯文本组成)
HTML Tags (case-insensitive 大小写不敏感)
- HTML tags are keywords (tag names) surrounded by angle brackets like <html>
- They normally come in pairs like <b> and </b> 通常成对出现,虽然大部分浏览器可以显示正确HTML without End tag, 但是考虑到严格版本的XHTML,最好还是写上。
- The first tag in a pair is the start (opening )tag , the second tag is the end (closing ) tag
- Some HTML elements do not have an end tag like<br>
The World Wide Web Consortium (W3C) recommends lowercase in HTML 4, and demands lowercase tags in XHTML.
W3C 建议在HTML4和XHTML中标签使用小写。因此,尽管 HTML 5 标准没有要求标签小写,我们使用小写的标签。
HTML Elements
Strictly speaking, an HTML element is everything between the start tag and the end tag, including the tags.
严格来说,HTML元素指的是在开标签和闭合标签之间所有的东西,包括这两个标签。
HTML elements can be nested (elements can contain elements 也就是说一个元素的内容可以是其他元素).
HTML elements with no content are called empty elements.
没有内容的元素被称为空元素
<br> is an empty element without a closing tag (it defines a line break 回车).
Tip: In XHTML, all elements must be closed. Adding a slash inside the start tag, like <br />, is the proper way of closing empty elements in XHTML (and XML).
因此尽管HTML 5没有要求空元素要闭合,为了让你的文档对于XML解析器是可读的,记得闭合所有HTML元素。
文件后缀
HTML files should have a .html extension (not .htm).