HTML <a> href Attribute Last Updated : 23 May, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The HTML <a> href attribute is used to specify the URL of the page that the link points to. When the href attribute is not present in the <a> element, it will not function as a hyperlink. This attribute is essential for creating links to any address and is used in conjunction with the <a> tag. Syntax<a href="URL"> Link text </a>Attribute ValuesAbsolute URL: It points to another website.Relative URL: It points to a file within a website.Anchor URL: It points to an anchor within a page.Example: This example demonstrates the use of href attribute in <a> element. HTML <!DOCTYPE html> <html> <head> <title>HTML a href Attribute</title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML a href Attribute</h2> <a href="https://www.geeksforgeeks.org/"> Click Here to Open in Same Tab </a> <br> <a href="https://www.geeksforgeeks.org/html-tutorial/" target="_blank"> Click Here to Open in a New Tab </a> </body> </html> Output Supported BrowsersChrome 1Edge 12Firefox 1Opera 15Safari 1 Comment More infoAdvertise with us Next Article HTML <a> href Attribute M manaschhabra2 Follow Improve Article Tags : Web Technologies HTML HTML-Attributes Similar Reads HTML | <area> href Attribute The <area> href attribute is used to specify the URL of the target page. When the href attribute is not present in the <area> an element that it will not be a hyperlink. Syntax: <area href="URL"> Attribute Value: absolute URL: It points to another website.relative URL: It points to 1 min read HTML | <a> hreflang Attribute The HTML hreflang Attribute is used to specify the language for a linked document. It is used only when the href attribute is set. Syntax: <a hreflang="language_code"> Attribute Values: language_code: It specify the language code of the Linked Document. Example: html <!DOCTYPE html> < 1 min read HTML <base> href Attribute HTML <base> href Attribute specifies the base URL for all relative URLs in a document, serving as the reference point for resolving relative links and resources. Syntax:Â <base href="URL">Attribute Values: It contains the value i.e URL which specifies the absolute URL that defines the ba 1 min read HTML href Attribute HTML href Attribute: It is used to specify the URL of the document. It contains the full address of the page that the user requests. It is used to link or connect one document to another document.Supported tags:HTML <a> href AttributeHTML <base> href AttributeHTML <area> href Attri 3 min read HTML | <a> rel Attribute The rel attribute is used to specify the relationship between the current and the linked document. It is used only when the href attribute is present. Syntax:<a rel="value">Attribute Values:alternate: It defines an alternate version of the document i.e. print page, translated, or mirror.author 1 min read Like