Updated: 27 Feb 2008
This doc attempts to show how custom buttoms with a 1px radius could be created without corner images. The gradient requires an image, but is optional. Ideally, the <button>
element should be used if possible (instead of <a>
) for semantic and accessibility reasons. Note that the hover state will not work on button
elements for IE6 and lower without using JavaScript to detect a mouseOver event.
span
creates the top and bottom borders. Because button
and a
are inline elements, top/bottom borders and padding do not affect the height of parent elements (such as the outer span
). So with the same top/bottom padding of both span
elements, the left/right borders of the outer span
stop short of the top/bottom borders of the inner span
.span
is necessary to fix bugs in Gecko-based browsers and in IE (separate issues for both). Gecko browsers add an extra 3px of padding inside button
elements which can't be eliminated. Without the outer span, top/bottom and left/right borders wouldn't connect. IE just has trouble styling button
s and nested elements inside them, so the majority of visible styles are applied to two inner span
s.