Horje

How to add HTML <style> type Attribute

Definition and Usage

The type attribute specifies the Internet media type (formerly known as MIME type) of the <style> tag.

The type attribute identifies the content between the <style> and </style> tags.

The default value is "text/css", which indicates that the content is CSS.


Browser Support

Syntax

<style type="media_type">

Use the type attribute to specify the media type of the <style> tag :

Attribute Values

Value Description
media_type The Internet media type of the style sheet. For now, the only supported value is "text/css". Look at IANA Media Types for a complete list of standard media types
index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
<style>
h1 {color:red;}
p {color:blue;}
</style>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Output should be:

How to add HTML <style> type Attribute




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin