HTML - href (hypertext reference) attribute

About

href stands for hypertext reference.

It forces the user agent (browser) to navigate to the resources by performing an Hypertext fetch

All elements that have an href attributes are called hyperlink and creates a reference relationship.

Metadata

In dublin core metadata, the reference (ie the value of href) is stored in the References filed

Special # value

The empty fragment value #:

  • points to the top of the current page
  • cause local scrolling to the top of the page but will never navigate (ie perform a http get request).
  • is misused by programmers when the href value is determined programmatically in Javascript. See Programmatic href

Programmatic href

If you need to determine the href value programmatically, do it on the server and if you can't.

  • unset the href attribute
  • and set the cursor style to pointer to still advertise that there is a link. Example
#your-link-id {
  "cursor":"pointer"
}

Powered by ComboStrap