Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the difference between CSS subselector and descendant selector

Shulou Source: shulou.com Published: 2022-06-01 12:33:52 10月02日 Update

This article mainly shows you "what is the difference between CSS sub-selector and descendant selector". The content is easy to understand and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "what is the difference between CSS sub-selector and descendant selector".

It is difficult to distinguish between the "sub-determiner" of CSS (greater than the identification table flag > in CSS) and the "Kunming selector" of CSS. In fact, there is still a big difference between them. The "son and daughter selector" IE6, or even lower IE versions, is already supported. Perhaps you have been confused by these "mouthful" and "ingenious" nouns. What is the "younger generation choice charm" after all? In fact, everyone has used it. Take a look at the above example and you will be familiar with it. At the moment, whether it is FireFox or IE7, support for "sub-determiners" is not necessarily a problem.

Article sample page

/ * descendant decision symbol * /

# div1 p {

Color:red

}

/ * Sub-select character * /

# div1 > p {

Font-size:150%

}

I am the son of div1.

I'm div1's grandson.

I'm div1's son 2.

In the example, "p1" and "p2" sweep into the "div1", then "p1" and "p2" are the sons and children of "div1", while "p1room1" is contained in "p1", then "p1room1" is the son of "p1" and is the elder. And "p1room1" is also contained in "div1", then "p1room1" is the grandson and child of "div1". Using "# div1 p {color:red;}" (the descendant chooser) sets the font color of all paragraphs on the div1 to red. Be obedient to both children and grandchildren. "only if my descendants have to listen to me!" This is the "symbol of choice for future generations".

On the other hand, the "son determination character" will not be so bossy. Of course, its "son" will not take care of "grandson", "great grandson" and "great grandson".

The above is all the content of the article "what is the difference between CSS sub-selector and descendant selector". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Choices sons grandchildren offspring content descendants articles children examples face learning help support obedience bossy mouthful Gao Miao examples all nouns Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Tech Info vpn Shulou Technology Redmi