HTML <style> scopedAttribute
Examples
Use the scope attribute to describe the styles of a <div> element:
<div>
<style type="text/css" scoped>
h1 {color:red;}
p {color:blue;}
</style>
<h1>This heading is red</h1>
<p>This paragraph is blue.</p>
</div>
Try it Yourself »
Browser Support
The numbers in the table specify the first browser version that fully supports the attribute.
| Attribute | |||||
|---|---|---|---|---|---|
| scoped | Not supported | Not supported | 21.0 | Not supported | Not supported |
Definition and Usage
This attribute has been removed and is not recommended for use.
The scoped attribute is a boolean attribute.
If this attribute is used, the styles apply only to the parent element of the style element and its child elements.
Differences between HTML 4.01 and HTML5
The scoped attribute is new in HTML5.
Differences between HTML and XHTML
In XHTML, attribute minimization is not allowed, and the scoped attribute must be defined as: <style scoped="scoped" />.
Syntax
<style scoped>
HTML <style> Tag Other Extensions