Skip to main content
HTML Validation

Element “link” is missing one or more of the following attributes: “href”, “itemprop”, “property”, “rel”, “resource”.

About This HTML Issue

The <link> element defines a relationship between the current document and an external resource. It’s most often used in the <head> to load stylesheets, declare icons, specify canonical URLs, or provide metadata. The HTML specification requires that at least one of href, itemprop, property, rel, or resource be present on any <link> element. A bare <link> tag with none of these attributes has no defined purpose and is therefore invalid.

This validation error typically occurs in a few scenarios:

  • A <link> element was added as a placeholder and never completed.
  • Attributes were accidentally removed or misspelled during editing.
  • A templating engine or build tool generated an incomplete <link> tag.
  • The rel attribute was omitted when only href was technically sufficient, but the developer intended to specify a relationship.

While browsers may silently ignore an empty <link> element, leaving it in your markup creates clutter, signals incomplete code, and violates the HTML standard. Keeping your HTML valid ensures predictable behavior across browsers and assistive technologies.

How to fix it

Check every <link> element in your document and make sure it includes at least one of the required attributes. In practice, most <link> elements should have both rel and href:

  • rel — specifies the relationship (e.g., stylesheet, icon, canonical, preconnect).
  • href — provides the URL of the linked resource.
  • itemprop — used for microdata markup.
  • property — used for RDFa or Open Graph metadata.
  • resource — used in RDFa to identify a resource by URI.

If a <link> element has no valid purpose, remove it entirely.

Examples

Invalid: <link> with no required attributes

<link type="text/css">

The type attribute alone does not satisfy the requirement. The validator will flag this element.

Invalid: <link> with only crossorigin

<link crossorigin="anonymous">

crossorigin is not one of the required attributes, so this is still invalid.

Valid: stylesheet with rel and href

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

Valid: favicon with rel and href

<link rel="icon" href="/favicon.ico" type="image/x-icon">

Valid: preconnect hint

<link rel="preconnect" href="https://fonts.googleapis.com">

Valid: canonical URL

<link rel="canonical" href="https://example.com/page">

Valid: Open Graph metadata with property

<link property="og:image" href="https://example.com/image.png">

Valid: microdata with itemprop

<link itemprop="url" href="https://example.com">

Full document example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>My Page</title>
    <link rel="stylesheet" href="styles.css">
    <link rel="icon" href="/favicon.ico">
    <link rel="canonical" href="https://example.com/my-page">
  </head>
  <body>
    <h1>Hello, world!</h1>
  </body>
</html>

Each <link> element in this document has both a rel and an href attribute, making them valid and clearly communicating their purpose to browsers and validators.

Find issues like this automatically

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

Help us improve our guides

Was this guide helpful?

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