How to Understand the semantic HTML structure _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
I believe everyone knows html and css, know the separation of html structure and css performance, and know the meaning of html. These are popular keywords in recent years. Semantic html was sought after only one or two years ago in China. Now let's look at the html structure discussed in the group. semantic html occupies a large part of the html structure interview questions. So why should we use semantic HTML? I believe everyone knows about html and css, know the separation of html structure and css performance, and know the meaning of html. These are popular keywords in recent years. Semantic html was sought after only one or two years ago in China. Now let's look at the html structure discussed in the group. semantic html occupies a large part of the html structure interview questions. So why should we use semantic HTML? What are the benefits of semantic HTML?

HTML provides the context structure and meaning of the webpage document content. html itself does not show any performance. We can see that it is in bold, the font size is 2em, And the content is bold;It is bold. Do not think this is the performance of html. In fact, the default css style of html is working. Therefore, we must first know that html and page performance are irrelevant, these are css tasks. The role of HTML in the page is structure and meaning. In layman's terms, it is to divide the content. Here we put what we put.

The Semantic HTML structure must emphasize the HTML structure first.

The HTML structure is the skeleton of the page, and a page is like a house. The HTML structure is a steel reinforced concrete wall, if a house does not have a steel reinforced concrete wall, it is a pile of bricks, can not live, can not work. Css is the decorative material, the log floor, the marble, the paint, and the decoration of the house. CSS is powerful and needless to say. If css has no html structure, it is a pile of boards, paint Together, no practical use value. CSS relies entirely on the (X) HTML document that references it. If you want to make full use of CSS capabilities, it is necessary to provide html with both clean and structured content, "HTML is a universal term for publishing hypertext on the internet ...... HTML uses tags to structure text "(Http://www.w3.org/MarkUp/).

How to Write a semantic HTML structure?
HTML is a method to supplement the structure and meaning (or semantics) of text content. It will tell us: "This line is a title, which forms a paragraph. These texts are the project list, which is a hyperlink to another file on the Internet ." It is worth noting that HTML should not tell us: "These texts are blue and red. This part of content is the rightmost column, and this line of content is italic ." These information related to performance is the work of CSS. When developing a front-end development, remember: HTML tells us what a piece of content is (or its meaning), rather than what it looks like. When we mention "semantic tag", the HTML we call should be completely separated from the presentation information, and the labels should all define the structure of the document in a semantic manner.

The Semantic HTML structure is actually very simple. First, grasp the semantics of each tag in html,

Is a container;Is to emphasize;

  • Is an unordered list... When you see the content, think about what label can better describe it, and what label is used.

    What are the benefits of semantic HTML structure?

    We know the tags added to HTML5, such

    And Html is developing towards a more robust semantic HTML structure. xhtml2 is not advanced in html5. this is also a cause of the death of xhtml2, this also shows that the semantic HTML structure is the development trend of html.

    1. Clear structure of the page when the style is removed or lost:

    Html itself is not shown, we can see that it is bold, the font size is 2em, bold;It is bold. Do not think this is the performance of html. In fact, the default html css style is working, therefore, removing or losing styles makes the page display a clear structure, which is not an advantage of semantic HTML structure. However, all browsers have default styles, the purpose of the default style is to better express the semantics of html. It can be said that the default style of the browser is inseparable from the semantic HTML structure.

    2. The screen reader (if a visitor has a visual fault) will "read" Your webpage based on your tag..

    For example, if you use a semantic tag, the screen reader will "spell your words one by one" instead of trying to complete its pronunciation.

    3. devices such as PDAs and mobile phones may not be able to render webpages like normal computer browsers (usually because these devices have weak support for CSS ).

    Using semantic tags ensures that these devices render webpages in a meaningful way. Ideally, the task of watching a device is to render the webpage in line with the conditions of the device.

    Semantic tags provide the required information for devices, saving you from considering all possible display conditions (including existing or future devices ). for example, a mobile phone can choose to display a text section marked with a title in bold. the palm may be displayed in a relatively large font. either way, once you mark the text as the title, you can be sure that the reading device will display the page according to its own conditions.

    4. Search engine crawlers also rely on tags to determine the weights of context and keywords.

    In the past, you may not have considered that search engine crawlers are also website "visitors", but now they are actually extremely valuable users. without them, the search engine will not be able to index your website, and then the average user will be very sad to visit.

    5. Whether your page is easy to understand is very important for crawlers, because crawlers ignore the tags used for presentation, rather than semantic tags.

    Therefore, if the title of the page file is marked rather than, the page may be positioned at the back of the search result. in addition to improving ease of use, semantic tagging is conducive to correct use of CSS and JavaScript, because it provides many "hooks" to apply the style and behavior of pages.
    SEO mainly depends on the content of your website and external links.

    6. easy team development and maintenance

    W3C has set a good standard for us. Everyone in the team follows this standard, which can reduce many differentiated things, facilitate development and maintenance, improve development efficiency, and evenImplement modular Development.

    If you have different opinions, please leave a message to discuss them.

    Thanks to ghost Brother, milk tea, Xiaozhi, stealing rice, Caspar, and css forest groups.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.