# Bad value “X” for attribute “rel” on element “Y”: The string “X” is not an absolute URL.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-rel-on-element-y-the-string-x-is-not-an-absolute-url
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `rel` attribute defines the relationship between the current document and a linked resource. The HTML specification maintains a set of recognized keyword values for this attribute, and the allowed keywords vary depending on which element the attribute appears on. For example, `stylesheet` is valid on `<link>` but not on `<a>`, while `nofollow` is valid on `<a>` and `<form>` but not on `<link>`.

When the validator encounters a `rel` value that isn't a recognized keyword, it checks whether the value is a valid absolute URL. This is because the HTML specification allows custom link types to be defined using absolute URLs as identifiers (similar to how XML namespaces work). If the value is neither a recognized keyword nor a valid absolute URL, the validator raises this error.

Common causes of this error include:

- **Typos in standard keywords** — for example, `rel="styelsheet"` or `rel="no-follow"` instead of the correct `rel="stylesheet"` or `rel="nofollow"`.
- **Using non-standard or invented values** — such as `rel="custom"` or `rel="external"`, which aren't part of the HTML specification's recognized set.
- **Using relative URLs as custom link types** — for example, `rel="my-custom-type"` instead of a full URL like `rel="https://example.com/my-custom-type"`.

This matters because browsers and other user agents rely on recognized `rel` values to determine how to handle linked resources. An unrecognized value will simply be ignored, which could mean your stylesheet doesn't load, your prefetch hint doesn't work, or search engines don't respect your intended link relationship. Using correct values ensures predictable behavior across all browsers and tools.

## Examples

### Incorrect: Misspelled keyword

```html
<link rel="styleshet" href="main.css">
```

The validator reports that `styleshet` is not a recognized keyword and is not an absolute URL.

### Correct: Fixed spelling

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

### Incorrect: Non-standard keyword on an anchor

```html
<a href="https://example.com" rel="external">Visit Example</a>
```

The value `external` is not a standard `rel` keyword in the HTML specification, so the validator flags it.

### Correct: Using a recognized keyword

```html
<a href="https://example.com" rel="noopener">Visit Example</a>
```

### Incorrect: Relative URL as a custom link type

```html
<link rel="my-custom-rel" href="data.json">
```

### Correct: Absolute URL as a custom link type

If you genuinely need a custom relationship type, provide a full absolute URL:

```html
<link rel="https://example.com/rels/my-custom-rel" href="data.json">
```

### Correct: Common valid `rel` values

Here are some frequently used standard `rel` keywords with their appropriate elements:

```html
<!-- Linking a stylesheet -->
<link rel="stylesheet" href="styles.css">

<!-- Linking a favicon -->
<link rel="icon" href="favicon.ico">

<!-- Preloading a resource -->
<link rel="preload" href="font.woff2" as="font" type="font/woff2" crossorigin>

<!-- Telling search engines not to follow a link -->
<a href="https://example.com" rel="nofollow">Sponsored link</a>

<!-- Opening a link safely in a new tab -->
<a href="https://example.com" target="_blank" rel="noopener noreferrer">External site</a>
```

### Multiple `rel` values

You can specify multiple space-separated `rel` values. Each one must individually be either a recognized keyword or a valid absolute URL:

```html
<!-- Correct: both values are recognized keywords -->
<a href="https://example.com" target="_blank" rel="noopener noreferrer">External</a>

<!-- Incorrect: "popup" is not a recognized keyword or absolute URL -->
<a href="https://example.com" target="_blank" rel="noopener popup">External</a>
```

To resolve this error, consult the [MDN `rel` attribute reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel) for the full list of recognized keywords and which elements support them. If your value isn't on the list, either replace it with the correct standard keyword or use a complete absolute URL to define your custom link type.
