The application of 1.css selector;
Generally speaking, to write css, you must define an id or class before you can use it. In fact, an element that defines an id or class can be followed by descendants. For example,
& ltdiv id = " test " & gt
& ltp & gtxxxxxxxxxx & ltspan & gtxxxxxxxxx & lt/span>。 xxxxxxxxxxxxxxxxx & lta href = " # " & gtxxxxxxxx & lt/a & gt; & lt/p & gt;
& lt/div & gt;
With this structure, you can use the elements under div.
# test p
# Test Span
# test a
This definition is the same as writing a class, which is convenient to save the name of each element.
2.2. Level of CSS:
Css has many layers. Simply say a few.
Embedded style > id defined style >; Styles defined with classes
What do you mean, like it's full of this?
& ltstyle & gt
#test{font-size: 16px}
. Test {font-size: 14px}
& lt/style & gt;
& ltp id = " test " class = " test " style = " font-size: 12px " >xxxxxxxxxxxxxx & lt/p & gt;
The final executed style is font-size: 12px. The same style will be overwritten by the highest level, and different styles will not affect it. This can be used to classify styles in detail.
Another useful level rule is that the more detailed the definition, the higher the level, such as the example just now.
& ltdiv id = " test " & gt
& ltp & gtxxxxxxxxxx & ltspan & gtxxxxxxxxx & lt/span>。 xxxxxxxxxxxxxxxxx & lta href = " # " & gtxxxxxxxx & lt/a & gt; & lt/p & gt;
& lt/div & gt;
If I write css:
a{font-size: 16px}
# Test a{font-size: 14px}
# Test p a{font-size: 12px}
Then the font size of the A tag in the above code is 12px, and the so-called definition details are the details of the parent tag of the element you want to define.
3.3. Level coverage:
This means that you can write multiple classes, such as
& ltp class = " class 0 1 class 02 class 03 " >xxxxxxxxx & lt/p & gt;
This p tag defines three classes, all of which will take effect, and the latter will cover the former.
For example, these three classes are
. class 0 1 { font-size: 16px; Color: #333}
. class 02 { font-size: 14px; font-weight:bold}
. class 03 { font-size: 12px; font-family:"SimSun"}
Finally, the three attributes of color, font thickness and font family are realized, while the font size is 12px. It is considered that class03 is written at the end, which can be used to realize various styles and combine new styles.
Personally, I think this is the most important thing. As for compatibility and css3, I can't say clearly. In short, if you want to learn, you need to learn more and practice more, and there is no other way.