English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Reference

HTML link href attribute

The href attribute specifies the location (URL) of the external resource (usually a stylesheet file).

 HTML <link> tag

Online Example

Link to an external stylesheet:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <link> href Attribute Usage-Basic Tutorial(oldtoolbag.com)</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>I am formatted with a linked style sheet</h1>
<p>Me too!/p>
</body>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the href attribute.

Definition and Usage

The href attribute specifies the location of an external resource (usually a stylesheet file) (URL).

HTML 4.01 and HTML5Differences between

None.

Syntax

<link href="URL">

Attribute value

ValueDescription
URLLinked resource/URL of the document.

Possible values:

  • Absolute URL - points to another website (e.g., href="http://www.example.com/theme.css")

  • Relative URL - points to a file within the website (e.g., href="/themes/theme.css")

 HTML <link> tag