I. Benefits of semantic HTML tags:
1. Easy to process for people and easy to understand for machines (search engines.
2. You can directly set styles for elements without adding other identifiers. This effectively avoids code expansion.
Ii. H4 is created by the document markup language, rather than the interface language. There are no more semantic elements. Currently, there are two main ways to make element semantics:
1. Use H5 tags (H5 includes header, section, article, footer, nav and Other semantic tags ).
2. Use class and ID to assign semantics to existing elements.
Note:
1. Use Id and class to name elements based on what they are, rather than based on their appearance. For more information, see Bootstrap.
2. Do not abuse the class. deleting unnecessary classes helps simplify the code and make the page more concise.
3. Div and span are elements that add a page structure.
Note:
1. Do not use divitus)
2. The DIV should be used when no existing element can achieve regional division. In the following example, no div is required:
1 <div class="nav">2 <ul>3 <li></li>4 <li></li>5 </ull> 6 </div>
You can directly use the following code:
<ul class="nav"> <li></li> <li></li></ull>
3. When using Div and span, you must know when a compromise must be made and the correct cause.
4. Actually, div is also a semantic block (box ).
Iv. Document Type
1. DTD: Document Type defer is a set of machine-readable rules. Defines what should appear in a specific version of XML or HTML, and does not allow anything to appear.
2. doctype: the browser analyzes the doctype Declaration on the page to find out which DTD to use and which version of HTML to use (DTD is declared by doctype ).
Conclusion: doctype defines which DTD version is used, and DTD defines which html version is used. Therefore, doctype directly determines which html version to use.
Of course, in addition to adding tags Based on semantics (which version is selected), doctype also has the validity verification function. browser mode selection, doctype switching (listener): select the rendering mode based on whether doctype exists, it is used by browsers to distinguish legacy documents from standard documents.