Priority and weight analysis of CSS selectors
This article mainly shares with you the priority and weight analysis of CSS selectors, hoping to help you learn more about CSS selectors.
Basic Selector
Selector | Name | Instance | Description | Version |
---|---|---|---|---|
Universal selectors | *
| Match all elements2.1 | ||
Tag selectors (Type selectors) | p
| matches all
| 1||
Class selectors | .nav
| Matches all elements with class="nav"
| 1||
ID selectors | #wrapper
| match all## Elements with #id="wrapper"
1 |
||
Attribute selectors | a[data-url] |
Elements | # that match of all data-url attributes ##2.1
|
E[attr=val] |
a[data-url=' http'] |
Match all data-url="http" | elements with the attribute 2.1
|
E[attr~=val] | |
a[data-url~='http'] |
Matches all data-url | attributes containing http elements 2.1
|
E[attr^=val] | |
a[data-url^='http'] |
Matches all data-url | attributes starting with http elements 3
|
E[attr$=val] | |
a[data-url$='http' ] |
Matches all data-url | attributes ending with http elements 3
|
E[attr*=val] | |
a[data-url*='http '] |
Matches all data-url | attributes containing http
3
| E FDescendant selectors | |
p p | match all |
| elements under the element
1 ##E > F |
sub Selectors (Child selectors) |
Matches all children |
| 2.1
E + F
| Adjacent sibling selector||
Match all | The first element's sibling | Element
| 2.1
E ~ F
| Sibling selector|
Match all | elements with the same All | elements of level
| 3
##S1,S2,... selector Group |
label,input |
match all |
##:link | a:link | ||
---|---|---|---|
:visited |
a:visited | Matches visited links | |
:hover |
a:hover | Matches the element over which the mouse pointer is floating | |
:active |
a:active | Matches the element over which the mouse pointer is pressed | |
:focus |
input:focus | Matches the element that receives focus | |
The target pseudo-classes |
The target pseudo-class specifies the currently active anchor. You can use the target pseudo-class to set styles for the active anchor. |
Instance
Description
##:target | #tab1:target | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The language pseudo-classes Language pseudo-classes add styles to elements with the specified
The UI element status pseudo-class is mainly used to specify the status of elements in the form.
enabled/disabled Selector
whereInstanceDescription
InstanceDescription
|
The above is the detailed content of Priority and weight analysis of CSS selectors. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Detailed explanation of the Linux process priority adjustment method. In the Linux system, the priority of a process determines its execution order and resource allocation in the system. Reasonably adjusting the priority of the process can improve the performance and efficiency of the system. This article will introduce in detail how to adjust the priority of the process in Linux and provide specific code examples. 1. Overview of process priority In the Linux system, each process has a priority associated with it. The priority range is generally -20 to 19, where -20 represents the highest priority and 19 represents

The priority order of C language: 1. Various parentheses; 2. All unary operators; 3. Multiplication operator *, division operator /, remainder operator %; 4. Addition operator +, subtraction operator - ; 5. Shift operator <<, >>; 6. Greater than operator >, greater than or equal to operator >=, less than operator <, less than or equal to operator <=; 7. Equal to operator ==, not equal to operator Symbol != 8. Bitwise AND operator & 9. Bitwise XOR operator ^ 10. Bitwise OR operator | 11. Logical AND operator && and so on.

Use the :nth-child(n+3) pseudo-class selector to select the style of child elements whose position is greater than or equal to 3. The specific code example is as follows: HTML code: <divid="container"><divclass="item"> ;First child element</div><divclass="item"&

There are many operators in Go language, which are often used to perform various mathematical and logical operations. Each operator has its own precedence, which determines the order in which they are evaluated in an expression. This article will introduce you to the priority ranking of operators in the Go language and find out the operator with the highest priority. The operators in Go language are as follows in order from high to low precedence: parentheses: (). Parentheses are used to change the precedence order of operators. Parentheses in expressions are evaluated first. Unary operators: +, -, !. Unary operator means that only one

The "C" compiler evaluates expressions according to precedence and associativity rules. If an expression contains operators of different precedence, precedence rules are taken into account. Here, 10*2 is evaluated first because '*' has higher precedence than '-' and '='. If the expressions contain the same precedence, the associativity rule is considered, i.e. from left to right (or from right to the left).

lxml is a powerful Python library for processing XML and HTML documents. As a parsing tool, it provides a variety of selectors to help users easily extract the required data from documents. This article will introduce the selectors supported by lxml in detail. lxml supports the following selectors: Tag selector (ElementTagSelector): Select elements by tag name. For example, select elements with a specific tag name by using <tagname>

To deeply understand the process priority in Linux, specific code examples are required. In the Linux system, the priority of the process is a very important concept. By properly setting the priority of the process, you can effectively control the allocation of system resources and improve system performance. This article will delve into the concept of process priority in Linux and demonstrate and practice it through specific code examples. 1. The concept of process priority in Linux. In the Linux system, the priority range of a process is -20 to 19, where -20 represents the highest priority.

In-depth analysis of is and where selectors: improving the level of CSS programming Introduction: In the process of CSS programming, selectors are an essential element. They allow us to select and style elements in an HTML document based on specific criteria. In this article, we will take a deep dive into two commonly used selectors namely: is selector and where selector. By understanding their working principles and usage scenarios, we can greatly improve the level of CSS programming. 1. is selector is selector is a very powerful choice
