# The “icon” element is a completely-unknown element that is not allowed anywhere in any HTML content.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-icon-element-is-a-completely-unknown-element-that-is-not-allowed-anywhere-in-any-html-content
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `<icon>` element does not exist in HTML. No version of the HTML specification defines it, and browsers do not recognize it.

This error appears when markup includes `<icon>` as if it were a standard HTML element. It is not. Browsers will treat it as an unknown inline element with no default behavior or semantics. To display icons, use an `<img>` element, an `<svg>` element, or a `<span>` with CSS-applied background images or icon fonts.

If the intent is to define a favicon (the small icon shown in browser tabs), the correct approach is a `<link>` element inside `<head>` with `rel="icon"`.

## HTML examples

### Invalid: using the `<icon>` element

```html
<head>
  <title>My page</title>
  <icon src="favicon.png"></icon>
</head>
```

### Valid: using a `<link>` element for a favicon

```html
<head>
  <title>My page</title>
  <link rel="icon" href="favicon.png" type="image/png">
</head>
```

### Valid: displaying an icon inline with `<img>`

```html
<p>
  <img src="star.svg" alt="Star" width="16" height="16"> Favorite
</p>
```

### Valid: displaying an icon inline with `<span>` and CSS

```html
<p>
  <span class="icon icon-star" aria-hidden="true"></span> Favorite
</p>
```
