Horje
What is 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

Related Articles
How to add HTML accept Attribute HTML Input HTML Attribute
How to add HTML accept-charset Attribute HTML Attribute
What is HTML accesskey Attribute HTML Attribute
What is HTML action Attribute HTML Attribute
What is HTML alt Attribute HTML Attribute
What is HTML async Attribute HTML Attribute
What is HTML autocomplete Attribute in HTML HTML Attribute
What is HTML autofocus Attribute HTML Attribute
What is HTML autoplay Attribute HTML Attribute
What is HTML charset Attribute HTML Attribute
What is HTML checked Attribute HTML Attribute
What is HTML cite Attribute HTML Attribute
What is HTML class Attribute HTML Attribute
What is HTML cols Attribute HTML Attribute
What is HTML colspan Attribute HTML Attribute
What is HTML content Attribute HTML Attribute
What is HTML contenteditable Attribute HTML Attribute
What is HTML controls Attribute HTML Attribute
What is HTML coords Attribute HTML Attribute
What is HTML data Attribute HTML Attribute
What is HTML data-* Attribute HTML Attribute
What is HTML datetime Attribute HTML Attribute
What is HTML controls Attribute HTML Attribute
What is HTML default Attribute HTML Attribute
What is HTML defer Attribute HTML Attribute
What is HTML dir Attribute HTML Attribute
What is HTML dirname Attribute HTML Attribute
What is HTML disabled Attribute HTML Attribute
What is HTML download Attribute HTML Attribute
What is HTML draggable Attribute HTML Attribute
What is HTML enctype Attribute HTML Attribute
What is HTML enterkeyhint Attribute HTML Attribute
What is HTML for Attribute HTML Attribute
What is HTML form Attribute HTML Attribute
What is HTML formaction Attribute HTML Attribute
What is HTML headers Attribute HTML Attribute
What is HTML height Attribute HTML Attribute
What is HTML hidden Attribute HTML Attribute
What is HTML high Attribute HTML Attribute
What is HTML href Attribute HTML Attribute
What is HTML hreflang Attribute HTML Attribute
What is HTML http-equiv Attribute HTML Attribute
What is HTML id Attribute HTML Attribute
What is HTML inert Attribute HTML Attribute
What is HTML inputmode Attribute HTML Attribute
What is HTML ismap Attribute HTML Attribute
What is HTML kind Attribute HTML Attribute
What is HTML label Attribute HTML Attribute
What is HTML lang Attribute HTML Attribute
What is HTML list Attribute HTML Attribute
What is HTML loop Attribute HTML Attribute
What is HTML low Attribute HTML Attribute
What is HTML max Attribute HTML Attribute
What is HTML maxlength Attribute HTML Attribute
What is HTML media Attribute HTML Attribute
What is HTML method Attribute HTML Attribute
What is HTML min Attribute HTML Attribute
What is HTML multiple Attribute HTML Attribute
What is HTML muted Attribute HTML Attribute
What is HTML name Attribute HTML Attribute
What is HTML novalidate Attribute HTML Attribute
What is HTML onabort Attribute HTML Attribute
What is HTML onafterprint Attribute HTML Attribute
What is HTML onbeforeprint Attribute HTML Attribute
What is HTML onbeforeunload Attribute HTML Attribute
What is HTML onblur Attribute HTML Attribute
What is HTML oncanplay Attribute HTML Attribute
What is HTML oncanplaythrough Attribute HTML Attribute
What is HTML onchange Attribute HTML Attribute
What is HTML onclick Attribute HTML Attribute

Single Articles
How to add The href attribute specifies the link's destinationHTML Attribute
How to add An image map, with clickable areasHTML Attribute
How to add Specify a base URL for all relative URLs on a pageHTML Attribute
How to add Link to an external stylesheetHTML Attribute

Read Full:
HTML Attribute
Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded:
1 week ago
Uploaded by:
Admin
Views:
30


Reffered: https://www.w3schools.com/tags/att_href.asp

Share on: