Related Articles

Related Articles

HTML | scoped Attribute
  • Last Updated : 30 Sep, 2019

The HTML scoped attribute is a boolean attribute which 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).

Supported tag:

  • style

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:

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

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :