Skip to main content
HTML Validation

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

About This HTML Issue

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

<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

<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:

object {
  border: 2px solid;
}

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries