Some details of CSS

Source: Internet
Author: User

1, the ID selector has the highest weight, can cover some of the previous definitions, such as

1 <HTML>2 <Head>3 <styletype= "Text/css">4 #color{5 Color:Red;6 }7 P{8 Color:Blue;9 }Ten </style> One </Head> A <Body> - <PID= "Color">Test</P> - </Body> the </HTML>

The font color for "test" is red.

2, by default, the height of the parent element is automatically adjusted according to the content of the child element, but if the child element is set to float, the parent element's height becomes 0, which is why sometimes the parent element's background color is set and the parent element is not found ... The workaround is as follows,

To set the style for the parent element:

1{2    content: "020";  3    display: block;  4    height: 0;  5    clear: both;  6 }7{8    Zoom: 1;  9 }

Use pseudo-classes to clear floats.

Some details of CSS

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: 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.