/    Sign up×
Reference /Pin to ProfileBookmark

The <a> tag, or Anchor element, defines a hyperlink to any URL on the web, including web pages, files, email addresses, telephone numbers, anchors on the same page – anything that a URL can address.

Syntax

The most important attribute is href, which provides the address to which the element is linked.

<a href="https://webdeveloper.com/">Visit WebDeveloper.com</a>

Attributes

download
Specifies that the targeted URL will be downloaded to the users computer. Can be used with or without a value

href
Provides the address to which the element is linked.

hreflang
Identifies the language that the linked URL is in.

media
Identifies the media or device that the linked URL is optimized for.

ping
Sends post requests with the body ping to a comma separated list of URLs when the link is clicked.

referrerpolicy
Depending on the specified value, determines how much of the referrer to send.

rel
Depending on the specified value, specifies the relationship between the linked item and the current URL.

target
Determines where the linked URL is opened (current window, new window, etc.)

type
Provides the linked URL’s format in Mime-type.

Browser Compatibilty

Demos

User-submitted codepen.io examples of <a>

@Nibrock

See the Pen on CodePen.

@ZalorCakeLord

See the Pen on CodePen.

@themolitorNice! I was expecting the effects to happen on hover at first. "Fancy link" should probably say "click this fancy link" or something?
@ZalorCakeLordThat's a good idea! I didn't think of it for some reason lol.
@dianirawan

See the Pen on CodePen.

Want to Contribute?

Submit a codepen.io link that demonstrates <a>:

to submit a demo.
HTML
×

Success!

Help @reference spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...