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 self-service freelancing marketplace for people like you.

HTML <link> type Attribute

The type attribute on an <link> tag specifies the media type of the linked file.

A media type indicates the format and nature of the file.

Example

#

A type attribute on an <link> element. The attribute specifies the media type (formerly MIME type) of the stylesheet.

A paragraph styled with external css.

<link rel="stylesheet" type="text/css" href="/tutorial/style.css">

<p class="aliceblue">A paragraph styled with external css.</p>

Using type

The type attribute specifies the media type of the linked file.

A media type, formerly known as a MIME type, indicates the format and nature of a file.

Browsers don't look at a link's file extension, but rather what media type it is.

A list with common HTTP Media Types is available on this site.

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

Tip:   The IANA organization maintains a list of all official media types.


Syntax

<link href="URL" type="media-type" />

Note: The type attribute requires that href has a value.


Values

#

Value Description
media-type The media type of the linked page. For a stylesheet 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 <link>
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 self-service freelancing marketplace for people like you.

Guides