strong {color:red;}"."/> strong {color:red;}".">

Home  >  Article  >  Web Front-end  >  What does the greater than symbol mean in css

What does the greater than symbol mean in css

藏色散人
藏色散人Original
2020-12-11 09:15:203600browse

The greater than symbol in css is a child element selector unique to CSS3. The child element selector can only select elements that are child elements of a certain element. Its syntax is such as "h1 > strong {color:red;}".

What does the greater than symbol mean in css

The operating environment of this article: windows10 system, css3, thinkpad t480 computer.

Recommended: "css Video Tutorial"

The greater than symbol (">") in css represents the unique sub-element selector of css3 (element>element) . Child selectors can only select elements that are children of an element.

If you do not want to select any descendant elements, but want to narrow the scope and select only the child elements of a certain element, please use the child selector (Child selector).

For example, if you want to select only strong elements that are children of the h1 element, you can write:

h1 > strong {color:red;}

This rule will turn the two strong elements below the first h1 red , but the strong in the second h1 is not affected:

Example:







This is very very important.

This is really very important.

css child element selector

element>element selector is used to select a specific parent element.

Note: If the element is not selected, you cannot directly specify the child element of the parent.

The sub-selector uses the greater than sign (sub-combination symbol).

Subconjuncts can have whitespace characters on both sides, which is optional. Therefore, there is no problem with the following writing:

h1 > strong
h1> strong
h1 >strong
h1>strong

If read from right to left, the selector h1 > strong can be interpreted as "select all strong elements that are children of the h1 element".

The above is the detailed content of What does the greater than symbol mean in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn