English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The scoped attribute is a boolean attribute. If the scoped attribute is used, the style is only applied to the parent element of the style element and its child elements.
Use the scope attribute to describe the style of the <div> element:
<div> <style type="text/css" scoped> h1 {color:yellow;} p {color:green;} </style> <h1>This title is yellow</h1> <p>This paragraph is green.</p> </div>Test see ‹/›
attribute | |||||
---|---|---|---|---|---|
scoped | Not supported | Not supported | 21.0 | Not supported | Not supported |
The scoped attribute is a boolean attribute.
If the scoped attribute is used, the style is only applied to the parent element of the style element and its child elements.
The scoped attribute is an HTML5 new attributes added.
In XHTML, attributes are not allowed to be abbreviated, the scoped attribute must be defined as: <style scoped="scoped" />.
<style scoped>HTML <style> tag