Presentation of precedence for CSS style sheets

Source: Internet
Author: User
css| Style Sheet <!--
You can see that the direct redefinition of the label style is the least effective, followed by the "." The pseudo class that is defined,
Again, with a redefinition of the label Plus pseudo class (similar to H2.myclass{color:blue}), the highest level is the CSS style defined with the ID-->
<HTML>
<HEAD>
<STYLE>
h1{color:red;}
. Myclass{color:green}
H2.myclass{color:blue}
#myid {Color:brown}
</STYLE>
</HEAD>
<BODY>
<H1> This is a red title. </H1>
<p class= "MyClass" > uses the text in the P tag of the "MyClass" pseudo class is green. </P>
<H2 class= "MyClass" > but the title second in the "MyClass" class is blue because H2.myclass{color:blue has overridden the MyClass pseudo class. </H2>
The <p class= "MyClass" id= "myID" > The text identified with "myID" is brown, which is the highest priority. </P>
</BODY>
</HTML>



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.