W3Schools.com

HTML <a> href Attribute

HTML a Tag Reference HTML <a> tag

Example

The href attribute specifies the URL of the page the link goes to:

<a href="http://www.w3schools.com">Visit W3Schools</a>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The href attribute is supported in all major browsers.


Definition and Usage

The href attribute specifies the URL of the page the link goes to.

The href or the name attribute must be present in the <a> tag.


Syntax

<a href="URL">

Attribute Values

Value Description
URL The URL of the link.

Possible values:

  • An absolute URL - points to another web site (like href="http://www.example.com/default.htm")
  • A relative URL - points to a file within a web site (like href="default.htm")
  • An anchor URL - points to an anchor within a page (like href="#top")


HTML a Tag Reference HTML <a> tag
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE