pub struct Link;Expand description
The <link> element - external resource link.
§Purpose
The <link> element specifies relationships between the current document and external resources.
Most commonly used to link to stylesheets, but also used for favicons, alternate versions,
preloading resources, and more.
§Content Categories
- Metadata Content
§Permitted Content Model
- None (void element)
§Common Use Cases
- Linking to external CSS stylesheets
- Specifying favicons and touch icons
- Defining alternate language versions of a page
- Preloading or prefetching resources
- Linking to RSS/Atom feeds
§Key Attributes
rel: Relationship type (e.g.,"stylesheet","icon","preload","canonical")href: URL of the linked resourcetype: MIME type of the linked resourcemedia: Media query for conditional loading (mainly for stylesheets)as: Type of content being preloaded (whenrel="preload")
§Example
<head>
<link rel="stylesheet" href="styles.css">
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="preload" href="font.woff2" as="font" type="font/woff2" crossorigin>
<link rel="alternate" hreflang="es" href="https://example.com/es/">
</head>§WHATWG Specification
Trait Implementations§
Source§impl HtmlElement for Link
impl HtmlElement for Link
impl CanContain<Link> for Head
impl MetadataContent for Link
Auto Trait Implementations§
impl Freeze for Link
impl RefUnwindSafe for Link
impl Send for Link
impl Sync for Link
impl Unpin for Link
impl UnwindSafe for Link
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more