Skip to content
Related Articles

Related Articles

HTML | scoped Attribute

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 27 May, 2022

The HTML scoped attribute is a boolean attribute that is used to specify that the styles only apply to this element’s parent element and that element’s child elements (not the entire document).
Note : It is a deprecated attribute and it is not supported by HTML5. 

Supported tag: 
 

Example: 
 

html




<!DOCTYPE html>
<html>
 
<head>
    <style>
 
    </style>
</head>
 
<body>
    <center>
        <div>
            <style scoped>
                h1 {
                    color: green;
                }
                 
                h2 {
                    color: black;
                }
            </style>
 
            <h1 style="red">GeeksforGeeks</h1>
            <h2>HTML scoped attribute</h2>
        </div>
    </center>
</body>
 
</html>

Output: 
 

Supported Browsers: The browsers supported by HTML scoped Attribute are listed below: 
 

  • Firefox

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!