CSS cascade style learning [2]

Source: Internet
Author: User
1. Rules
Selector
Any HTML element can be a CSS1 selector. The selector is only an element pointing to a special style. For example, P {text-indent: 3em}
The selection character is P.
Class selector
A single selector can have different classes, so the same element can have different styles. For example, a web builder may want to display the code in different colors based on the language: code.html {color: #191970}
Code.css {color: #4b0082}
The preceding example creates two classes, css and html, which are used by html code elements.
The CLASS attribute is a CLASS used to specify elements in HTML. For example,
P. warning {font-weight: bolder; color: red; background: white} <p class = warning> The ID selector individually defines the composition of each element. This option should be used as few as possible, because it has certain limitations. The specified ID must have an indicator "#" before the name. For example, the ID selector can specify the following: # svp94O {text-indent: 3em}. For details, refer to the ID attribute in HTML: <p id = svp94O> text indent 3em </P> join selector is only a string consisting of two or more single delimiters separated by spaces. These delimiters can specify general attributes, and their priority is higher than that of a single delimiters due to cascade order rules. For example, the following context selector p em {background: yellow} is p em. This value indicates that the highlighted text in a paragraph will be a yellow background, while the highlighted text in the title will not be affected.
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.