Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <style> type Attribute

The type attribute on a <style> tag specifies the media type of the style content.

A media type specifies the type and nature of the content.

On a <style> tag, the default is ‘text/css‘.

Example

#

A type attribute on a <style> element. The attribute specifies the media type (formerly MIME type) of the CSS rules.

Your order has been approved!

We will send you a confirmation email shortly.

<style type="text/css">
   .success { color: teal; }
</style>

<h4 class="success">Your order has been approved!</h3>
<p>We will send you a confirmation email shortly.</p>

Using type

The type attribute specifies the media type of the style's content.

The default for a <style> element is 'text/css'.

Tip:   For a <style> the default is 'text/css'. Since CSS is the only styling language, you can omit the type specification.


Syntax

<style type="media-type">

Values

#

Value Description
media-type The media type of the style rules. The default is 'text/css'.

Browser support

Here is when type support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <style>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides