Descendants are selected with spaces, such as a b{border:1px solid red;}
A descendant selector, such as a>b{border:1px solid red;}
But if you think about it, these two concepts are not a duplicate of the place,
are descendants also descendants?
are descendants not descendants?
The relationship between the two is not discussed, so let's see what's different in CSS.
First on the code:
<! DOCTYPE html>
Descendant selector:
Descendant selector:
It can be said that the difference is quite large, from the effect can be seen:
Descendants refer to all descendants, while the Offspring refers to the first generation
Is it true?
Let's look at another example:
We modify the CSS code, and the HTML code does not change:
<style> . Zero ul { color:red; } </style>
To run using the descendant selector:
Run with the descendant selector:
What the hell, how exactly?
Please note the modification options here, I am not directly using the LI tag,
In addition, I modified the color attribute.
In fact, the above conclusions are still correct.
The situation above, we need to consider the inheritance ,
You know, a property such as color can be inherited, which means
The descendant's font has no default color, so it inherits from the father
Yes, if that's the case, then why didn't it start with inheritance?
The answer is: the border property cannot be inherited and cannot be inherited like border
Also have the following properties:
Display, margin, border, padding,
Background, height, min-height, Max-height,
width, min-width, max-width, overflow, position,
Left, right, top, bottom, z-index, float, clear,
Table-layout, Vertical-align, Page-break-after,
Page-bread-before and Unicode-bidi.
The first 4 of them are measured by me, and the rest is on the network.
Information, accuracy cannot be determined.
That's to figure out why there was a effect,
A situation that does not have the same effect.
The difference between a Css descendant selector and a descendant selector