All HTML elements are selectors (all HTML elements are HTML)
The previous course defines the elements of
For example, set the background color for the entire body below
Body {
background-color: #C6E2FF;
}
Multiple selectors (multiple selectors)
You can nest an HTML element inside another, for example,
<div>
<div>
<p>i like tacos!</p>
In this case, how does CSS give inside that inside of the <p> definition selector?
The method is as follows:
<span style= "font-size:14px" >div div p {
/*css stuff!*/
}</span>
One selector to rule them all (global selector)
There is a very special selector that can be used to define all the elements of HTML: * Selector. For example:
* {
border:2px solid black;
}
The black boundary of the entity will be set to 2 pixels for all elements.
Branching (branch)
You can think of an element of an HTML file as a tree (pictured above): The elements are branched from the root node
Parents, children, and siblings (father, son and brother)
If the
The nested selector above is set in this tree structure.
If the son of an element wants to apply a certain format, and does not want to let his son's son ... This format is also applied, so you can use the > symbol.
For example:
<div>
<div>
<p> </p>
<div> <p> </div>
</div>
</div>
You just want to get a format for the <p> in line 3rd, so you can:
div div > P {/
* some CSS setting*/
}
Then the <p> on the inside will have no effect