HTML < style > Tag - Learn About Website | DaddyFile

0

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>

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.

Tips and Notes

Tip: To link to an external style sheet, use the <link> tag.

Note: If the "scoped" attribute is not used, each <style> tag must be located in the head section.

Differences Between HTML 4.01 and HTML5

The "scoped" attribute is new in HTML5, which allows to define styles for a specified section of the document. If the "scoped" attribute is present, the styles only apply to the style element's parent element and that element's child elements.


Post a Comment

 
Top