# The “border” attribute on the “input” element is obsolete. Consider specifying “img { border: 0; }” in CSS instead.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-border-attribute-on-the-input-element-is-obsolete-consider-specifying-img-border-0-in-css-instead
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `border` attribute is obsolete on the `<input>` element, and a border on an image button belongs in CSS.

Old markup often puts `border="0"` on `<input type="image">`, the image button, a habit copied from linked images. The HTML standard lists `border` on `input` as an obsolete attribute, and the validator warns about it on every input type, `submit` and `text` included.

Browsers still apply the attribute in one case. On an image button, a value above zero draws a solid border that many pixels wide. A value of `0` changes nothing, and browsers ignore the attribute on every other input type. On most pages you can delete it and nothing on screen changes.

The message suggests `img { border: 0; }`, but that rule styles `<img>` elements, not inputs. If the attribute had a value above zero and you want to keep the border, write a CSS rule for the image button itself.

## Invalid example

```html
<form action="/search">
  <input type="search" name="q" aria-label="Search">
  <input type="image" src="search.png" alt="Search" border="0">
</form>
```

## Valid example

```html
<form action="/search">
  <input type="search" name="q" aria-label="Search">
  <input type="image" src="search.png" alt="Search">
</form>
```

If the old value was `border="2"`, this rule in your stylesheet draws the same border:

```css
input[type="image"] {
  border: 2px solid;
}
```
