close
The Wayback Machine - https://web.archive.org/web/20240118174359/https://www.geeksforgeeks.org/html-scoped-attribute/
Open In App
Related Articles

HTML | scoped Attribute

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
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: 
 

BERJAYA

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

  • Firefox

 

Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 27 May, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials