CSS :scope pseudo-class Last Updated : 30 Aug, 2022 Comments Improve Suggest changes Like Article Like Report 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 Example 1: HTML <!DOCTYPE html> <html> <title>GeeksforGeeks</title> <body> <h1 style="text-align: center; color: green;" id="paragra"> Welcome to GeeksforGeeks. It's a Computer Science portal. </h1> <p style="color: #000; text-align: center;" id="opt"> </p> <script> let para = document.getElementById("paragra"); let opt = document.getElementById("opt"); if (para.matches(":scope")) { opt.innerText = "Yeah!!, we are under scope GeeksforGeeks"; } </script> </body> </html> Output: Example 2: HTML <!DOCTYPE html> <html> <head> <title>GeeeksforGeeks</title> <style> #contains { margin: 5% auto; max-width: 500px; background-color: #eeeeee; } section { padding: 60px; } :scope { background-color: #3cd33c; } </style> </head> <body> <div id="contains"> <section> <p> Inside the scope, <span style="color: green;"> GeeksforGeeks </span> </p> </section> </div> </body> </html> Output: Browser Support: Google Chrome 27+Edge 79+Firefox 32+Opera 15+Safari 7+ Comment More infoAdvertise with us Next Article CSS :scope pseudo-class T thacker_shahid Follow Improve Article Tags : Web Technologies CSS CSS-Selectors Similar Reads CSS :where() Pseudo-Class 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 with 2 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 Like