Instance
Syntax
1 |
<!DOCTYPE html>
|
2 |
<html lang="en"> |
3 |
<head>
|
4 |
<hyperlink rel="stylesheet" href="kinds.css" kind="textual content/css"> |
5 |
</head>
|
6 |
</html>
|
Browser Assist
The <hyperlink>
ingredient is supported in all fashionable browsers. Learn extra on caniuse.com.
Attributes
A hyperlink
ingredient helps International Attributes in HTML. International Attributes are frequent to all HTML parts and can be utilized on all of them (although they might not have a lot of an impact on a few of them).
A hyperlink ingredient should have both a rel
attribute or an itemprop
attribute, however not each.
There are a variety of extra attributes supported:
-
href
: Tackle of the hyperlink -
crossorigin
: How the ingredient handles crossorigin requests. -
rel
: Relationship between the doc containing the hyperlink and the vacation spot useful resource being fetched. -
media
: Relevant media. -
integrity
: Integrity metadata utilized in Subresource Integrity checks. -
hreflang
: Language of the linked useful resource. -
kind
: Trace for the kind of referenced useful resource. -
referrerpolicy
: Referrer coverage for fetches initiated by the ingredient. -
sizes
: Sizes of icons forrel="icon"
. -
imagesrcset
: Photos to make use of in numerous conditions for display resolutions. -
imagesizes
: Picture sizes for various web page layouts. -
as
: Potential vacation spot for a preload request (forrel="preload"
andrel="modulepreload"
). -
blocking
: Whether or not the ingredient is doubtlessly render-blocking. -
shade
: Coloration to make use of when customizing a website’s icon (forrel="mask-icon"
) -
disabled
: Whether or not the hyperlink is disabled.
Attribute Instance
Right here’s an instance of how a <hyperlink>
makes use of the rel=""
and hreflang=""
attributes to determine a relationship between the present doc and variations in different languages:
1 |
<hyperlink rel="alternate" href="/en/web page.html" hreflang="en" kind="textual content/html"> |
2 |
<hyperlink rel="alternate" href="/fr/web page.html" hreflang="fr" kind="textual content/html"> |
3 |
<hyperlink rel="alternate" href="/es/web page.html" hreflang="es" kind="textual content/html"> |
Content material
The hyperlink
ingredient helps no content material mannequin which implies you possibly can’t cross it any kind of content material.
- While the
<hyperlink>
ingredient is a sort of hyperlink, it shouldn’t be confused with the<a>
(anchor) ingredient; the hyperlinks by which we navigate HTML paperwork and information.