CSS negative pseudo-class is ":not(selector)". The ":not" negative pseudo-class directly matches elements that are not selected by the passed parameter selector. The passed parameters may not include added selectors or pseudo-elements. Selector.
Recommended: "css video tutorial"
: not (selector) is a negative pseudo-class in CSS (selector) and accepts a simple selector as parameter. Essentially, any other selector can be used (as a parameter).
:not (selector) matches elements that are not selected by the passed parameter selector. Passed parameters may not include additional selectors or pseudo-element selectors.
/* the X argument can be replaced with any simple selectors */ :not(X) { property: value; }
In this example, there is a li element with class "different":
<ul> <li></li> <li class="different"></li> <li></li> </ul>
CSS will select all li elements except class "different".
/* Style everything but the .different class */ li:not(.different) { font-size: 3em; }
You can apply pseudo-class selectors to all simple selectors (including element type selectors, universal selectors, attribute selectors, class selectors, ID selectors, pseudo-class selectors) to produce the same Effect.
p:not(:nth-child(2n+1)) { font-size: 3em; }
But if we use pseudo-element selectors as parameters, it will not produce the expected effect.
:not(::first-line) { /* ::first-line is a pseudo element selector and not a simple selector */ color: white; }
:Visual representation of multiple usages of not()
:The priority of the not() pseudo-class is the priority of its parameters. The :not() pseudo-class does not increase the priority of the selector like other pseudo-class selectors.
Negative pseudo-class selectors do not support nesting, so :not(:not(...)) is never allowed. Developers need to note that pseudo-elements are not simple selectors, so they are invalid as arguments to the :not() pseudo-class. In addition, you need to be careful when using attribute selectors, because some attribute selectors are not universally supported. Chaining a :not() selector with another :not() selector is also prohibited.
The above is the detailed content of What are CSS negated pseudo-classes?. For more information, please follow other related articles on the PHP Chinese website!

TonavigateReact'scomplexecosystemeffectively,understandthetoolsandlibraries,recognizetheirstrengthsandweaknesses,andintegratethemtoenhancedevelopment.StartwithcoreReactconceptsanduseState,thengraduallyintroducemorecomplexsolutionslikeReduxorMobXasnee

Reactuseskeystoefficientlyidentifylistitemsbyprovidingastableidentitytoeachelement.1)KeysallowReacttotrackchangesinlistswithoutre-renderingtheentirelist.2)Chooseuniqueandstablekeys,avoidingarrayindices.3)Correctkeyusagesignificantlyimprovesperformanc

KeysinReactarecrucialforoptimizingtherenderingprocessandmanagingdynamiclistseffectively.Tospotandfixkey-relatedissues:1)Adduniquekeystolistitemstoavoidwarningsandperformanceissues,2)Useuniqueidentifiersfromdatainsteadofindicesforstablekeys,3)Ensureke

React's one-way data binding ensures that data flows from the parent component to the child component. 1) The data flows to a single, and the changes in the state of the parent component can be passed to the child component, but the child component cannot directly affect the state of the parent component. 2) This method improves the predictability of data flows and simplifies debugging and testing. 3) By using controlled components and context, user interaction and inter-component communication can be handled while maintaining a one-way data stream.

KeysinReactarecrucialforefficientDOMupdatesandreconciliation.1)Choosestable,unique,andmeaningfulkeys,likeitemIDs.2)Fornestedlists,useuniquekeysateachlevel.3)Avoidusingarrayindicesorgeneratingkeysdynamicallytopreventperformanceissues.

useState()iscrucialforoptimizingReactappperformanceduetoitsimpactonre-rendersandupdates.Tooptimize:1)UseuseCallbacktomemoizefunctionsandpreventunnecessaryre-renders.2)EmployuseMemoforcachingexpensivecomputations.3)Breakstateintosmallervariablesformor

Use Context and useState to share states because they simplify state management in large React applications. 1) Reduce propdrilling, 2) The code is clearer, 3) It is easier to manage global state. However, pay attention to performance overhead and debugging complexity. The rational use of Context and optimization technology can improve the efficiency and maintainability of the application.

Using incorrect keys can cause performance issues and unexpected behavior in React applications. 1) The key is a unique identifier of the list item, helping React update the virtual DOM efficiently. 2) Using the same or non-unique key will cause list items to be reordered and component states to be lost. 3) Using stable and unique identifiers as keys can optimize performance and avoid full re-rendering. 4) Use tools such as ESLint to verify the correctness of the key. Proper use of keys ensures efficient and reliable React applications.


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

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
