Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

what are css selectors' levels? are there any difference between level 3 and level 4?

I can't understand what is point in the CSS selector's levels. and I want to know the answer.

I have a reference about it but i can't figure it out how this works or how they relate to each other??


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From the specification

Cascading Style Sheets does not have versions in the traditional sense; instead it has levels. Each level of CSS builds on the previous, refining definitions and adding features

In CSS, each new level is adding new feature to the previous one. As simple as that. Starting from the CSS Level 3 this logic will be applied to each module:

CSS Level 3 builds on CSS Level 2 module by module, using the CSS2.1 specification as its core. Each module adds functionality and/or replaces part of the CSS2.1 specification. The CSS Working Group intends that the new CSS modules will not contradict the CSS2.1 specification: only that they will add functionality and refine definitions. As each module is completed, it will be plugged in to the existing system of CSS2.1 plus previously-completed modules.

From this level on modules are levelled independently: for example Selectors Level 4 may well be completed before CSS Line Module Level 3. Modules with no CSS Level 2 equivalent start at Level 1; modules that update features that existed in CSS Level 2 start at Level 3.

CSS selectors Level 4 is the last Specification written for CSS selectors and it's an improvement of the Level 3. You can clearly see that each level is adding new selectors.


You don't really need to bother with Levels. All you need to know is the selectors and how to use them and especially their browser support. (a useful tool that can help you: https://caniuse.com/)

Below the Specification of each level:

https://www.w3.org/TR/selectors-4/

https://www.w3.org/TR/selectors-3/

You can also find at the end of the last specification a section called Changes Since Level 3


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...