Home  >  Article  >  Web Front-end  >  What does css selector mean?

What does css selector mean?

藏色散人
藏色散人Original
2020-12-14 09:21:232208browse

css selectors can help us select tags that need to be styled. CSS selectors include: 1. id selector; 2. Class selector; 3. Label selector; 4. Adjacent selector ; 5. Child selector; 6. Descendant selector; 7. Wildcard selector, etc.

What does css selector mean?

The operating environment of this tutorial: windows7 system, css3 version, thinkpad t480 computer.

css selector (selector) can help us select the tags that need to be styled. Each CSS style definition consists of two parts, in the following form: selector {style} The part before {} is the "selector".

The selector specifies the object of the "style" in {}, that is, which elements in the web page the "style" acts on.

What are the selectors (selectors) of CSS?

id selector (for example # myid): matches any element with an ID equal to "myid".

Class selector (eg.myclassname): matches any element whose class is equal to "myclassname".

Label selector (eg. div, h1, p): selects all elements with the specified element name .

Adjacent selector (e.g. h1 p): used to select (not internally) the element immediately following the specified first element.

Child selector (e.g. ul > li): used to select elements with specific parent elements, for example, select all

    elements whose parent is each
  • element. (Recommended: "css Video Tutorial")

    Descendant selector (example: li a): used to select elements inside the element.

    Wildcard selector (*): matches any element.

    Attribute selector (a[rel = "external"], etc.): Select elements with specific attributes.

    Pseudo-class selector (a: hover, li:nth-child, etc.)

    For more programming-related knowledge, please visit: Programming Teaching! !

    The above is the detailed content of What does css selector mean?. 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