X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <style> type Attribute

HTML style Tag Reference HTML <style> tag

Example

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

<style type="text/css">
h1 {color:red;}
p {color:blue;}

</style>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The type attribute is supported in all major browsers.


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 value "text/css" indicates that the content is CSS.


Differences Between HTML 4.01 and HTML5

In HTML5, the type attribute is no longer required for CSS. The default value is "text/css".


Syntax

<style type="media_type">

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


HTML style Tag Reference HTML <style> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook