CSS :where() Pseudo-Class Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The :where() pseudo-class is helpful for minimization of longer code in a longer CSS selector list. It avoids repetition, just replace multiple selectors with a single one. In :where() pseudo-class you can also override. Syntax: class_Name :where(html-tages) html-tag { /* CSS code */ } Selector without :where() pseudo-class: .className li em, .className section em, .className p em { // CSS code } Selector with :where() pseudo-class: className :where(li, section, p) em { //CSS code } Example 1: HTML <!DOCTYPE html> <html> <head> <style> * { margin: 0; padding: 0; box-sizing: border-box; } /* CSS selector with :where() pseudo-class */ .GeeeksforGeeks :where(section, p) em { background: green; color: white; } </style> </head> <body style="text-align:center"> <h1 style="color:green;"> GeeksforGeeks </h1> <h2>CSS The :where() pseudo-class</h2> </br> <div class="GeeeksforGeeks"> <p><em> A computer science portal for geeks. </em></p> </br> <section> <em> Geeks classes an extensive classroom programme. </em> </section> </div> </body> </html> Output: where pseudo class Example 2: It is easy to override :where() pseudo-class as given in the below example. HTML <!DOCTYPE html> <html> <head> <style> * { margin: 0; padding: 0; box-sizing: border-box; } /* CSS selector with :where() pseudo-class overriden */ .GeeeksforGeeks :where(section, p) em { background: rgb(231, 118, 231); color: white; } .GeeeksforGeeks em { background: green; color: white; } </style> </head> <body style="text-align:center"> <h1 style="color:green;"> GeeksforGeeks </h1> <h2> CSS :where() pseudo-class </h2> </br> <div class="GeeeksforGeeks"> <h2>This is GeeeksforGeeks website</h2> </br> <p> <em> If it will not override, then the background colour of this text is purple </em> </p></br> <section> <em> If it will override, then the background colour of this text is green </em> </section> </div> </body> </html> Output: where pseudo class Browser Support: Firefox 78+Chrome 72 (enable it by experimental web platform features) Comment More infoAdvertise with us Next Article Explain the term âpseudo-classâ in CSS3 K kartik Follow Improve Article Tags : CSS CSS-Functions Similar Reads CSS :scope pseudo-class A scope element forms a context for a block of styles. That element provides a reference point for selectors to be matched against. A scope element is defined using the scoped attribute. Styles declared with scoped attributes will be applied to all elements inside its parent element. Syntax: :scope 1 min read CSS Pseudo-classes A pseudo-class is a keyword added to a CSS selector, prefixed by a colon (:), to define a specific state or condition of an element. It is used to style elements like a hovered button, the first child of a container, or checked input fields.Syntaxselector:pseudo-class { /* styles */}Interactive/User 6 min read CSS :has() pseudo-class Selector The CSS :has() pseudo-class is a relatively new feature that allows developers to select elements based on their children. It is a powerful tool for more specific and dynamic styling and can be used in conjunction with other pseudo-classes and selectors. The :has() pseudo-class is used to select par 2 min read CSS Class Selector CSS class selectors are one of the most versatile tools in your front-end development toolkit. They allow you to apply styles to multiple elements on a webpage, ensuring your design remains consistent and easily maintainable.Syntax.class-name{ property: value;}1. Basic class selectorThe basic class 4 min read Explain the term âpseudo-classâ in CSS3 Cascading Style Sheets referred to as CSS is a stylesheet language used to design and describe the presentation of the webpage to make it attractive. The main use of CSS is to simplify the process of making web pages presentable.The way elements should be rendered on screen is described by CSS. CSS 4 min read CSS Pseudo Elements A pseudo-element is a keyword added to a selector that lets you style specific parts of an element. For example, you can style the first line of a paragraph, add content before or after an element, or create complex effects with minimal code. Pseudo-elements are denoted by a double colon (::) (or : 4 min read Like