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

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-border-attribute-on-the-object-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 `<object>` element, and any border around embedded content belongs in CSS.

The attribute shows up mostly in old plugin embeds, where `border="0"` sat next to `width` and `height` on an `<object>` that loaded a Flash movie or a similar resource. The HTML standard lists `border` on `object` as an obsolete attribute, so the validator warns about it whatever its value.

A value of `0` draws no border, which is also what happens without the attribute, so you can delete `border="0"` and the page looks the same. A value above zero asks for a solid border that many pixels wide. To keep that border, write it as a CSS rule for the element.

The message suggests `img { border: 0; }`, but that rule styles `<img>` elements, not `<object>`. Write the rule for the `<object>` itself, or for a class on it.

## Invalid example

```html
<object data="map.svg" type="image/svg+xml" width="600" height="400" border="0">
  <img src="map.png" alt="Map of the hiking trails">
</object>
```

## Valid example

```html
<object data="map.svg" type="image/svg+xml" width="600" height="400">
  <img src="map.png" alt="Map of the hiking trails">
</object>
```

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

```css
object {
  border: 2px solid;
}
```
