Avoid six common HTML5 errors (2 )-

Source: Internet
Author: User
2. it is meaningless to use the header and hgroup to write unnecessary labels when necessary. Unfortunately, I often see meaningless misuse of headers and hgroups. You can read the two articles about the header and hgroup elements for a detailed understanding ...,. 2. Use the header and hgroup only when necessary.

Writing tags that do not need to be written is of course meaningless. Unfortunately, I often see meaningless misuse of headers and hgroups. You can read the two articles about the header and hgroup elements for a detailed understanding. The content is summarized as follows:

  • The header element represents a set of introductory or navigation-oriented secondary texts and is often used as the section header.

  • When the header has a multi-layer structure, such as a sub-head, sub-title, a variety of Logo text, etc., use hgroup to combine h1-h6 elements as the section header

Header abuse

Because the header can be used multiple times in a document, the Code style may be welcomed:

         
 
  
My best blog post
     
     

If your header element only contains one header element, discard the header element. Since the article element ensures that the header will appear in the document summary, and the header cannot contain multiple elements (as defined above), why do we need to write redundant code. Simply write it like this:

    My best blog post    
     


Incorrect Use

On the topic headers, I often see the incorrect use of hgroup. Sometimes hgroup and header should not be used simultaneously:


  • If there is only one Subheader

  • If the hgroup can work well

The first problem is generally as follows:

      
      
   
    
My best blog post
       
   

By Rich Clark


In this example, remove the hgroup and let the heading go.

  
       My best blog post    
   

by Rich Clark

The second problem is another unnecessary example:

      
      
   
    
My company Established 1893
       
  


If the unique sub-element of the header is hgroup, what about the header? If the header does not contain other elements (such as multiple hgroups), remove the header directly.

  
       My company    Established 1893    
  



The above is to avoid the common six HTML5 error usage (2) content. For more information, please follow the PHP Chinese Network (www.php1.cn )!

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.