Skip to main content
HTML Validation

A “link” element must have an “href” or “imagesrcset” attribute, or both.

About This HTML Issue

A link element is invalid unless it contains at least one of the href or imagesrcset attributes.

The link element is used to define relationships between the current document and external resources, most commonly stylesheets. According to the HTML standard, a link must have either an href attribute, which points to the resource, or an imagesrcset attribute for responsive icons. If both are missing, the validator throws an error. This ensures that the link actually references a resource, otherwise it serves no functional purpose.

Correct usage:

With an href (for stylesheets, icons, etc.)

<link rel="stylesheet" href="styles.css">

With imagesrcset (for responsive icons)

<link rel="preload" as="image" type="image/png" imagesrcset="icon-1x.png 1x, icon-2x.png 2x">

Last reviewed: May 05, 2025

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.