Breaking

Sunday, May 12, 2019

HTML style Tag

Example

Use of the <style> element in an HTML document:
<html>
<head>
<style>
h1 {color:red;}
{color:blue;}
</style>
</head>
<body>

<h1>A heading</h1>
<p>A paragraph.</p>

</body>
</html>
Try it Yourself »

Definition and Usage

The <style> tag is used to define style information for an HTML document.
Inside the <style> element you specify how HTML elements should render in a browser.
Each HTML document can contain multiple <style> tags.

Browser Support

Element
<style>YesYesYesYesYes

Tips and Notes

Tip: To link to an external style sheet, use the <link> tag.
Tip: To learn more about style sheets, please read our CSS Tutorial.


Attributes

= New in HTML5.
AttributeValueDescription
mediamedia_querySpecifies what media/device the media resource is optimized for
typetext/cssSpecifies the media type of the <style> tag

Global Attributes

The <style> tag also supports the Global Attributes in HTML.

Event Attributes

The <style> tag also supports the Event Attributes in HTML.

Related Pages

HTML tutorial: HTML CSS
CSS tutorial: CSS Tutorial
HTML DOM reference: Style Object

Default CSS Settings

Most browsers will display the <style> element with the following default values:
style {
  display: none;
}

No comments:

Post a Comment