HTML5 Introduction
HTML5 is the next-generation HTML standard specification after html4. It provides some new elements and attributes (such<nav>
Website navigation blocks and<footer>
). The new tags facilitate search engines and semantic analysis, and help small screen devices and People with Visual Impairment better. In addition, they also provide some new functions, such as video and audio<video>
And<audio>
To sum up, there are the following features:
- Removed some outdated element and attribute tags in html4.
These include purely display effect tags, such<font>
And<center>
They have been replaced by CSS. HTML5 draws some suggestions from xhtml2, including some functions used to improve the document structure, such as the new HTML Tagheader
,footer
,dialog
,aside
,figure
Suchdiv
.
- Separation of content and presentation
b
Andi
Labels are retained, but they have different meanings. These labels are used only to mark a text segment, rather than to set a bold or italic style for them.u
,font
,center
,strike
These labels are completely removed.
- Add some new form input objects
Including date, URL, and email address. Other objects are supported for non-Latin characters. HTML5 also introduces micro-data. This method uses tags that can be recognized by machines to label content, making Semantic Web processing easier. In general, these structure-related improvements allow content creators to create more clean and easier-to-manage webpages. Such webpages are more friendly to search engines and read screen software.
- Brand new and more reasonable labels
No more multimedia objects will be boundobject
Orembed
Tag, but the video has the video tag, and the audio has the audio tag.
This function is embedded with a local SQL database to accelerate interactive search, cache, and indexing. At the same time, those offline web programs will also benefit a lot. You do not need rich animations for plug-ins.
This will give the browser the ability to draw vector images directly above, which means that users can directly display graphics or animations in the browser without using flash and Silverlight.
IsHTMLDocument
AndHTMLElement
New API extensions are provided as an excuse.
- HTML5Replacing flash and Silverlight
Syntax (syntax) 1 file media type
Most HTML syntaxes defined by HTML5 are compatible with html4 and xhtml1, but some of them are not compatible. Most HTML documents are saved as text/html media types.
HTML5 defines detailed parsing rules (including error handling) for HTML syntax. You must follow these rules to save them as text/html media types. The following is an example that complies with HTML syntax specifications:
<!doctype html> Copy code
HTML5 also defines a text/html-sandboxed media type for the HTML syntax, so that the host does not trust the content.
Other syntaxes that can be used in HTML5 are XML, which is compatible with xhtml1. To use the XML syntax, you need to save the document as an XML media type, and set the namespace to http://www.w3.org/5o/xhtmlaccording to XML specifications.
The following example documents comply with the XML syntax specifications in HTML5. Note that XML documents must be saved as XML media types, such as application/XHTML + XML or application/XML.
<?xml version="1.0" encoding="UTF-8"?> Copy code
2 character encoding
In the HTML Syntax of HTML5, there are three forms to declare the encoding type of the string:
- On the transport level, set Content-Type in the header of the HTTP instance.
- Set a unicode byte order mark (BOM) at the beginning of the file. This character provides a signature for the file's encoding mode.
- In the content before the first 1024 bytes of the document, use the meta element with the charset attribute to declare the encoding method. For example, <meta charset = "UTF-8"> indicates that the document is in UTF-8 format. It replaces the original <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"> syntax declaration, although the original syntax is still available, but it is not recommended in HTML5.
The XML syntax in HTML5 is still the same as the previous XML syntax declaration.
3 doctype
HTML Syntax of HTML5 requires that the document declare doctype to ensure that the browser can display the page in standard mode. This doctype has no other purpose and is optional in XML, because documents in XML media format are always processed in standard mode.
The doctype declaration method is <! Doctype HTML>, case insensitive. The doctype declared in earlier versions of HTML takes a long time because the HTML language is based on SGML and therefore needs to reference a corresponding DTD. HTML5 is different from the previous version. You only need to declare doctype to tell the document to enable the HTML5 syntax standard. The browser will <! Doctype HTML> to do the rest of the work.
4 MathML and SVG
HTML5 HTML syntax allows you to use MathML (Mathematical Markup Language) and SVG (scalable vector graph) elements in your documents. For example, a very simple HTML page contains a circle drawn by an SVG element:
<!doctype html> <title>SVG in text/html</title> <p> A green circle: <svg> <circle r="50" cx="50" cy="50" fill="green"/> </svg> </p>
Copy code
More complex combined tags are also supported. For example, you can use the foreignobject element of SVG to nest MathML, HTML, or itself.
5 others
HTML5 is already native to support Siri, although these Siri can only be used in documents of UTF-8 and UTF-16.
If the lang attribute is set incorrectly, it will be updated to a null string to tell the browser that it is an unknown language, which serves the same purpose as XML: Lang in XML.
Original article address
HTML5 is the next-generation HTML standard specification after html4. It provides some new elements and attributes (such<nav>
Website navigation blocks and<footer>
). The new tags facilitate search engines and semantic analysis, and help small screen devices and People with Visual Impairment better. In addition, they also provide some new functions, such as video and audio<video>
And<audio>
To sum up, there are the following features:
- Removed some outdated element and attribute tags in html4.
These include purely display effect tags, such<font>
And<center>
They have been replaced by CSS. HTML5 draws some suggestions from xhtml2, including some functions used to improve the document structure, such as the new HTML Tagheader
,footer
,dialog
,aside
,figure
Suchdiv
.
- Separation of content and presentation
b
Andi
Labels are retained, but they have different meanings. These labels are used only to mark a text segment, rather than to set a bold or italic style for them.u
,font
,center
,strike
These labels are completely removed.
- Add some new form input objects
Including date, URL, and email address. Other objects are supported for non-Latin characters. HTML5 also introduces micro-data. This method uses tags that can be recognized by machines to label content, making Semantic Web processing easier. In general, these structure-related improvements allow content creators to create more clean and easier-to-manage webpages. Such webpages are more friendly to search engines and read screen software.
- Brand new and more reasonable labels
No more multimedia objects will be boundobject
Orembed
Tag, but the video has the video tag, and the audio has the audio tag.
This function is embedded with a local SQL database to accelerate interactive search, cache, and indexing. At the same time, those offline web programs will also benefit a lot. You do not need rich animations for plug-ins.
This will give the browser the ability to draw vector images directly above, which means that users can directly display graphics or animations in the browser without using flash and Silverlight.
IsHTMLDocument
AndHTMLElement
New API extensions are provided as an excuse.
- HTML5Replacing flash and Silverlight
Syntax (syntax) 1 file media type
Most HTML syntaxes defined by HTML5 are compatible with html4 and xhtml1, but some of them are not compatible. Most HTML documents are saved as text/html media types.
HTML5 defines detailed parsing rules (including error handling) for HTML syntax. You must follow these rules to save them as text/html media types. The following is an example that complies with HTML syntax specifications:
<!doctype html> Copy code
HTML5 also defines a text/html-sandboxed media type for the HTML syntax, so that the host does not trust the content.
Other syntaxes that can be used in HTML5 are XML, which is compatible with xhtml1. To use the XML syntax, you need to save the document as an XML media type, and set the namespace to http://www.w3.org/5o/xhtmlaccording to XML specifications.
The following example documents comply with the XML syntax specifications in HTML5. Note that XML documents must be saved as XML media types, such as application/XHTML + XML or application/XML.
<?xml version="1.0" encoding="UTF-8"?> Copy code
2 character encoding
In the HTML Syntax of HTML5, there are three forms to declare the encoding type of the string:
- On the transport level, set Content-Type in the header of the HTTP instance.
- Set a unicode byte order mark (BOM) at the beginning of the file. This character provides a signature for the file's encoding mode.
- In the content before the first 1024 bytes of the document, use the meta element with the charset attribute to declare the encoding method. For example, <meta charset = "UTF-8"> indicates that the document is in UTF-8 format. It replaces the original <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"> syntax declaration, although the original syntax is still available, but it is not recommended in HTML5.
The XML syntax in HTML5 is still the same as the previous XML syntax declaration.
3 doctype
HTML Syntax of HTML5 requires that the document declare doctype to ensure that the browser can display the page in standard mode. This doctype has no other purpose and is optional in XML, because documents in XML media format are always processed in standard mode.
The doctype declaration method is <! Doctype HTML>, case insensitive. The doctype declared in earlier versions of HTML takes a long time because the HTML language is based on SGML and therefore needs to reference a corresponding DTD. HTML5 is different from the previous version. You only need to declare doctype to tell the document to enable the HTML5 syntax standard. The browser will <! Doctype HTML> to do the rest of the work.
4 MathML and SVG
HTML5 HTML syntax allows you to use MathML (Mathematical Markup Language) and SVG (scalable vector graph) elements in your documents. For example, a very simple HTML page contains a circle drawn by an SVG element:
<!doctype html> <title>SVG in text/html</title> <p> A green circle: <svg> <circle r="50" cx="50" cy="50" fill="green"/> </svg> </p>
Copy code
More complex combined tags are also supported. For example, you can use the foreignobject element of SVG to nest MathML, HTML, or itself.
5 others
HTML5 is already native to support Siri, although these Siri can only be used in documents of UTF-8 and UTF-16.
If the lang attribute is set incorrectly, it will be updated to a null string to tell the browser that it is an unknown language, which serves the same purpose as XML: Lang in XML.
Original article address