Open In App

HTML | scoped Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

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

 


Last Updated : 27 May, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads