Test instance learning, research on writing CSS sequence

Source: Internet
Author: User
The final CSS style will overwrite all existing or conflicting styles defined earlier. For example, the following example:
P {color: red; background: yellow}
P {color: green}
The above section will eventually display a green font with a yellow background, because the color: green defined in the last section overwrites the previously defined red. Why does the yellow background not disappear, that is because the second p definition does not conflict with it, so it is valid.
Do you really understand? Okay. Let's do a small test:
P. red {color: red}
P. green {color: green}
P. blue {color: blue}
...
<P class = "red green blue"> Sample text. </p>
<P class = "green blue red"> Sample text. </p>
<P class = "blue red green"> Sample text. </p>
What color will the text in the above three paragraphs be displayed?
Think about it ^_^
The answer is that they are all displayed as blue, that is, blue. Although each paragraph applies three p styles in different order, it seems that the color should be determined according to the order of the applied styles. For example, the first display is blue, the second display is red, and the third display is green. In fact, this is incorrect. This is irrelevant to the order of the applied styles. They finally follow the last specified style, the color is blue.

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.