HTML Guides for image button
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
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
<form action="/search">
<input type="search" name="q" aria-label="Search">
<input type="image" src="search.png" alt="Search" border="0">
</form>
Valid example
<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:
input[type="image"] {
border: 2px solid;
}
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.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries