# Bad value X for attribute “media” on element “link”: The media “handheld” has been deprecated

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-media-on-element-link-the-media-handheld-has-been-deprecated
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `handheld` media type is deprecated, and the validator rejects any `media` attribute on a `<link>` element that still lists it.

CSS 2.1 defined `handheld` for small-screen devices with limited bandwidth. Few browsers honored it. Safari on the iPhone ignored it and applied `screen` styles, and so did the smartphone browsers that came after. Media queries based on viewport width took over as the way to adapt a layout to small screens. Media Queries Level 4 deprecated `handheld` together with `tty`, `tv`, `projection`, `braille`, `embossed` and `aural`. Browsers still accept these types but never match them, so a stylesheet linked with `media="handheld"` is never applied.

The validator quotes the whole attribute value, and it reports the error even when `handheld` sits in a list next to a valid type, as in `media="screen, handheld"`. In that case, delete `handheld` and keep the rest. If the stylesheet was meant for phones, replace `handheld` with a media query such as `(max-width: 480px)`. If it should apply everywhere, remove the `media` attribute.

Modern browsers have been skipping any stylesheet marked `handheld`, so switching it to a media query makes its rules apply for the first time. Review those rules before you make the change.

## Invalid example

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

## Valid example

```html
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="mobile.css" media="(max-width: 480px)">
```
