When using CSS selectors to control HTML markup, the properties of each selector can be declared more than once, and the selector itself can declare more than one at a time. And, any form of selector, is legal, tag Selector, class selector and ID selector can be collectively declared. When declaring a CSS selector, if the style of some selectors is exactly the same or partially the same, then the same style selector can be declared simultaneously using a collective declaration.
<span style= "FONT-SIZE:24PX;" >
Global Declaration
For a real site, if you want all of the markup in the page to use the same CSS style, but you don't want to collectively declare it individually, you can use the global declaration symbol * to declare it.
<span style= "FONT-SIZE:24PX;" >
You can see that the two declarations work exactly the same, but using a global declaration can make your code much less effective.
Nesting of selectors
In the CSS selector, you can declare HTML tags for special locations using nested methods.
For example, controlling the B mark in the P tag
<span style= "FONT-SIZE:24PX;" Nested declarations for ><HTML><HEAD><TITLE>CSS selectors </title><style type= "Text/css" ><!--P B{color: Maroon;text-decortion:underline;} --></style>
Nested selectors, which are very widely used, are not only nested tags themselves, but both category selectors and ID selectors can be nested.
The following code uses three layers of nesting, and in fact more layers of nesting are allowed, representing the. Top category of the <td> tag that contains the. TOP1 category of the <p> tag, which contains the <strong> tag that is declared by the style style.
<span style= "FONT-SIZE:24PX;" >td.top. Top1 strong{font-size:16px;} <TD class= "Top" ><p class= "Top1" > Other content <strong>css controlled parts </strong> other content </p></td> </span>
The
selectors are nested, and in CSS you can significantly reduce the declaration of class and ID, so when you build HTML for a page, you usually define class or ID only for the outer tag. The inner tag can be represented by nesting by using nested methods, so that no new class or ID needs to be defined, and a separate declaration is made only if the child tag cannot take advantage of the rule.