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 <a> type Attribute

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

A media type indicates the format and nature of a link or document.

On an <a> tag, the default is ‘text/html‘.

Example

#

A type attribute on an <a> tag. The attribute specifies the media type (formerly MIME type) of the linked page.

Go to Microsoft
Go to <a type="text/html" target="_blank"
         href="https://microsoft.com/">Microsoft</a>

Using type

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 media types is available on this site.

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


Common media types

There are hundreds of media types.
Below are some common ones that are used on the web.

Media Type Description
text/html HTML
image/png PNG
application/pdf PDF
application/vnd.ms-excel Excel
text/csv Comma Separated Values
video/mp4 MP4

Tip:  Check our HTTP Media Types Reference for a more complete list of common media types.


Syntax

<a 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 page link the default is 'text/html'.

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 <a>

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