Instance
Syntax
1 |
<!DOCTYPE html>
|
2 |
<html lang="en"> |
3 |
<head>
|
4 |
<hyperlink rel="stylesheet" href="kinds.css" sort="textual content/css"> |
5 |
</head>
|
6 |
</html>
|
Browser Help
The <hyperlink>
aspect is supported in all fashionable browsers. Learn extra on caniuse.com.
Attributes
A hyperlink
aspect helps International Attributes in HTML. International Attributes are widespread 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 aspect will need to have both a rel
attribute or an itemprop
attribute, however not each.
There are a variety of further attributes supported:
-
href
: Handle of the hyperlink -
crossorigin
: How the aspect 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. -
sort
: Trace for the kind of referenced useful resource. -
referrerpolicy
: Referrer coverage for fetches initiated by the aspect. -
sizes
: Sizes of icons forrel="icon"
. -
imagesrcset
: Pictures to make use of in numerous conditions for display screen 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 aspect is probably render-blocking. -
coloration
: Shade 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" sort="textual content/html"> |
2 |
<hyperlink rel="alternate" href="/fr/web page.html" hreflang="fr" sort="textual content/html"> |
3 |
<hyperlink rel="alternate" href="/es/web page.html" hreflang="es" sort="textual content/html"> |
Content material
The hyperlink
aspect helps no content material mannequin which suggests you possibly can’t go it any sort of content material.
- While the
<hyperlink>
aspect is a kind of hyperlink, it shouldn’t be confused with the<a>
(anchor) aspect; the hyperlinks by which we navigate HTML paperwork and information.