Horje
HTML href Attribute

Definition and Usage

For <a> and <area> elements, the href attribute specifies the URL of the page the link goes to.

For <base> elements, the href attribute specifies the base URL for all relative URLs on a page.

For <link> elements, the href attribute specifies the location (URL) of the external resource (most often a style sheet file).


Applies to

The href attribute can be used on the following elements:

Elements Attribute
<a> href
<area> href
<base> href
<link> href

Browser Support

The href attribute has the following browser support for each element.


How to add The href attribute specifies the link's destination

The a href attribute.
index.html
Example: HTML
<p>An absolute URL: <a href="https://horje.com">Horje</a></p>
<p>A relative URL: <a href="tag_a.asp">The a tag</a></p>

Output should be:

How to add The href attribute specifies the link's destination

How to add An image map, with clickable areas

Click on the computer, the phone, or the cup of coffee to go to a new page and read more about the topic:

index.html
Example: HTML
<img src="https://horje.com/avatar.png" alt="Workplace" usemap="#workmap" width="400" height="379">

<map name="workmap">
  <area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
  <area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
  <area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>

Output should be:

How to add An image map, with clickable areas

How to add Specify a base URL for all relative URLs on a page

Base Example.

index.html
Example: HTML
<head>
  <base href="https://horje.com">
</head>

Output should be:

How to add Specify a base URL for all relative URLs on a page

How to add Link to an external stylesheet

Link Example.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://www.w3schools.com/tags/styles.css">
</head>
<body>

<h1>Hello World!</h1>

<h2>I am formatted with a linked style sheet.</h2>

<p>Me too!</p>

</body>
</html>

Output should be:

How to add Link to an external stylesheet




html href attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference