
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML href Attribute
The href attribute of the <link> element is used to set the url of the external resource.
Following is the syntax −
<link href="url">
Above, the url is the url of the linked document. Let us now see an example to implement the href attribute of the <link> element −
Example
<!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="new.css"> </head> <body> <h1>Demo Heading</h1> <p>This is demo text.</p> </body> </html>
We have an external document above “new.css”, which is linked using href. This document is a CSS style file −
h1{ color − blue; } p{ background-color − red; }
Output
This will produce the following output. We styled the heading and text in the above “new.css” −
- Related Articles
- HTML href Attribute
- HTML href Attribute
- HTML href Attribute
- How to use href attribute in HTML Page?
- HTML DOM Anchor href Property
- HTML DOM Link href Property
- HTML DOM Location href Property
- HTML DOM Base href Property
- How to change the href attribute for a hyperlink using jQuery?
- HTML maxlength Attribute
- HTML wrap Attribute
- HTML checked Attribute
- HTML datetime Attribute
- HTML value Attribute
- HTML coords Attribute

Advertisements