HTML a Tag type Attribute Tutorial

In this section, we will see what the `type` attribute is and how it works.

What is type Attribute in HTML <a> Tag?

Via the HTML <a> element, we can link to documents of many types! For example, pdf, XML, ppt, etc. type of documents.

The type attribute is used to declare the media type of document that an HTML <a> tag is linked to.

The value of this attribute comes from MIME-Type! For example, if the target document is of type PDF, then the value of this attribute would be “application/pdf”.

HTML type Attribute in <a> Tag Syntax:

<a type = "MIME-Type">

<a> Tag type Attribute Values

The value of the type attribute comes from a list that can be checked in: https://www.iana.org/assignments/media-types/media-types.xhtml

For example, if the type of the target document is “PDF” then the value of the type attribute would be “application/pdf”.

Example: using type attribute in HTML <a> tag

See the Pen using type attribute in HTML <a> tag by Omid Dehghan (@odchan1) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies