HTML and style and scoped properties

HTML style scoped property HTML .lt;style> tags

Using the scoped property in a label restricts the style to affecting only the parent element of the label and all of its descendant elements.

Use the scope property to describe the style of the element:

<div>
<style type="text/css" scoped>
h1 {color:red;}
p {color:blue;}
</style>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</div>

Try it out . . .

Browser support

HTML style scoped property HTML style scoped property HTML style scoped property HTML style scoped property HTML style scoped property

Only Firefox properties support scoped properties.


Definitions and usages

The scoped property is a Boolean property.

If you use this property, the style applies only to the parent element of the style element and its children.


The difference between HTML 4.01 and HTML5

The scoped property is a new property in HTML5.


The difference between HTML and XHTML

In XHTML, the property is not allowed to be short-written, and the scoped property must be defined as: .


Grammar

<style scoped>

HTML style scoped property HTML .lt;style> tags