May 03, 2021 HTML5
HTML5 is used to represent the style used by the document. Please refer to the following example:
Use the element in html documents:
<html>
<head>
<style type="text/css">
h1 {color:red;}
p {color:blue;}
</style>
</head>
<body>
<h1>这是一个标题</h1>
<p>这是一个段落。</p>
</body>
</html>
All major browsers support the hashtag.
The label defines the style information for the HTML document.
In the element, you can specify how HTML documents are rendered in the browser.
Each HTML document can contain multiple labels.
Tip: To link to an external style sheet, use the hashtag.
Tip: To learn more about style sheets, read our CSS tutorial.
Note: If the "scoped" property is not used, each label must be in the head head area.
The scoped property is a new property in HTML 5 that allows us to define styles for a specified part of a document, not the entire document.
If you use the scoped property, the specified style can only be applied to the parent element of the style element and its children.
New: The new property in HTML5.
Property | Value | Describe |
---|---|---|
media | media_query | Specify different media types for style sheets. |
scoped | scoped | If you use this property, the style applies only to the parent element of the style element and its children. |
type | text/css | Specifies the MIME type of style sheet. |
The label supports the global properties of HTML.
The tag supports the event properties of HTML.
HTML tutorial: HTML CSS
HTML DOM Reference Manual: Style Object