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 <link> href Attribute

An href on a <link> tag specifies the URL of a style sheet or an icon.

Its value can be an internal or an external URL.

Example

#

A <link> element with an href attribute.
This link loads a stylesheet which is then used to style a paragraph.

Styled using external css.

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

<p class="aliceblue">Styled using external css.</p>

Here is the content of the stylesheet:

.aliceblue { background-color: aliceblue; color: steelblue; padding: 10px; }
.papaya { background-color: papayawhip; color: indianred; padding: 10px; }

Using link

The href attribute specifies the URL or path of the stylesheet or site icon.

This attribute on a <link> will load the specified stylesheet or site icon.

It accepts any of these URLs:

  • absolute URL - links to an external website or domain (e.g. https://wikipedia.com)
  • relative URL - links to a resource on the same website or domain (with a shorter url)

Syntax

<link href="URL" />

Values

#

Value Description
URL URL or path of the stylesheet or icon.

Browser support

Here is when href 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>

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