Common use of CSS and HTML errors

Source: Internet
Author: User
This time for everyone to bring CSS and HTML common use of the error, CSS and HTML use the attention of what, the following is the actual case, together to see.

misunderstanding one. Multiple P syndrome

<p class= "NAV" >    <ul>       <li><a href= "/home/" >Home</a></li>       <li ><a href= "/about/" >About</a></li>       <li><a href= "/concact/" >Concact</a> </li>    </ul></p>

The use of redundant P-tags as described above is called " Multi-P syndrome " and should be simplified into

<ul class= "NAV" >      <li><a href= "/home/" >Home</a></li>      <li><a href= "/ about/">About</a></li>      <li><a href="/concact/">Concact</a></li>< /ul>

Myth Ii. Multi-class class Syndrome note class can be applied to any number of elements of a page, and is ideal for identifying content types or other similar entries

A piece of news (news headlines, news details content)

<H1 class= "News-head" >elastic Layout example-view Source for the HTML and css

The above class names using News-head and News-text are called " Multi-class " manifestations and do not require so many classes to differentiate element styles

It is best to use p (pision) to represent parts rather than without semantics (most people misunderstand p without semantics!!!) In fact, p can divide the document into several meaningful areas.

The class name news thus identifies the entire news item. You can then use the cascading (Cascade) style to identify news headlines, text, and should be modified as follows

<p class= "News" >    

span groups or identifies inline elements


Myth three. ID usage myths are used to identify specific elements on a page (such as site navigation, headers, footers) and must be unique; can also be used to identify persistent structural elements (such as main navigation, content area)

/* Large number of Use IDs, difficult to find unique name confusion */#andy, #rich, #jeremy, #james-box, #sophie {    font-size:1em;    Font-weight:bold;    border:1px solid #ccc;} /* Simply replace it with a common class */.staff {    font-size:1em;    Font-weight:bold;    border:1px solid #ccc;}

Used to identify specific elements on a page (such as site navigation, headers, footers) and must be unique; can also be used to identify persistent structural elements (such as main navigation, content area)

Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!

Recommended reading:

Baidu Post-3D flop effect

CSS3 to achieve animated bike effects

Related Article

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.