The id is used to identify the unique element on the page. The name of the id is a means of controlling a certain content block. By placing a certain content block into a div and assigning it a unique id, you can use CSS selectors to accurately define the appearance of each page element. , including titles, lists, pictures, links or paragraphs, etc. For example, if you write a CSS rule for #header, it can be completely different from the image rule in #content.
Link styles in different content blocks can be defined through different rules. Something like this: #nav a:link or #main a:link or #footer a:link. You can also define different styles for the same elements in different content blocks. For example, define the styles of #main p and #sider p respectively through #main p and #sider p. Structurally speaking, your page is composed of pictures, links, lists, paragraphs, etc. These elements themselves do not affect which network device they are displayed on (PDA, mobile phone or Internet TV). They can be defined as Any performance appearance.
A carefully structured HTML page is very simple, and every element is used for structural purposes. When you want to indent a paragraph, you don't need to use the blockquote tag. Just use the p tag and add a CSS text-indent rule to p to achieve the indentation purpose. p is a structured tag and text-indent is a presentation attribute. The former belongs to HTML and the latter belongs to CSS. (This is the legendary separation of structure and expression)
Well-structured HTML pages have almost no attribute tags. The code is very clean and concise. For example, the original code can now be written only in HTML, and all things that control performance are written in CSS. In structured HTML, table is a table, not anything else (not to mention that it cannot be used for layout and positioning) ).
Of course, CSS selectors are not just that simple. In addition to ids and classes, there are also descendant selectors, attribute selectors, and so on.