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

> Canonical HTML version: https://rocketvalidator.com/html-validation/element-link-is-missing-one-or-more-of-the-following-attributes-href-itemprop-property-rel-resource
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

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

```html
<link type="text/css">
```

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

### Invalid: `<link>` with only `crossorigin`

```html
<link crossorigin="anonymous">
```

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

### Valid: stylesheet with `rel` and `href`

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

### Valid: favicon with `rel` and `href`

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

### Valid: preconnect hint

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

### Valid: canonical URL

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

### Valid: Open Graph metadata with `property`

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

### Valid: microdata with `itemprop`

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

### Full document example

```html
<!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.
