Content · Web Development · HTML

HTML hreflang and type Attributes on Links

Hreflang hints at the language of the linked resource, while type hints at its MIME type. Neither changes the link into a new kind of navigation.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Hreflang hints at the language of the linked resource, while type hints at its MIME type. Neither changes the link into a new kind of navigation. The important question is always where the link leads and whether the person reading the page can predict it.

What You Need to Know


The destination must really contain content in the advertised language or format. These are hints, not automatic translation or conversion tools.

Links are the pathways through a website. The words on a link should help someone choose where to go before clicking it.

Example: See It in Action


Take a look at this small piece of HTML. You can use it in a practice document and change the text to make it your own.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<a href="guide-fr.html" hreflang="fr" type="text/html">
    Lire la version française
</a>
<p>These attributes give hints about the linked resource.</p>

Let’s Understand the Example


  • An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
  • A p groups a paragraph of related text. Start another paragraph for a new thought.
  • Hreflang hints at the language of the linked resource; it does not translate the page.
  • Type changes the kind of input, script, resource or button, depending on the element.
  • Href contains the destination of a link. A value starting with # points to an id on the same page.

The first example link points to guide-fr.html. Check whether that destination exists relative to the document. A link changes where readers go; it does not perform an action such as saving a form.

What Should You See?


You should see a link named “Lire la version française”. Selecting it leads to guide-fr.html when that destination exists. Try it with the mouse and the keyboard.

Imagine this link is read out of context. Would its text still explain the destination? Rename unclear links before trying to make them look nicer with CSS.

Try It Yourself


  1. Make a language-alternate link with the correct language tag.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Setting hreflang="fr" on a page whose content is actually English.
  • Avoid dead links, empty href values and clickable-looking text without a real destination.

Key Takeaways


  • Hreflang hints at the language of the linked resource, while type hints at its MIME type.
  • An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
  • The destination must really contain content in the advertised language or format. These are hints, not automatic translation or conversion tools.
Share this resourceSend this page to someone who may find it useful.