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

What does the greater than sign mean in css

藏色散人
藏色散人Original
2021-01-14 09:19:524454browse

The greater than sign in css represents the CSS3-specific child element selector; the child element selector can only select elements that are child elements of a certain element; if you do not want to select any descendant elements, but want to narrow the range, To select only the child elements of an element, you can use the child element selector.

What does the greater than sign mean in css

The operating environment of this tutorial: windows7 system, css3 version, Dell G3 computer.

Recommended: css video tutorial

css refers to Cascading Style Sheets, which is a style used to express file styles such as HTML or XML Computer language is a programming language used to represent HTML styles. It is a style language that can separate web pages and content.

The greater than symbol in css

The greater than symbol (">") in css represents the CSS3-specific sub-element selector (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 sign 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