Sometimes designs contain button styling that is difficult to create with CSS alone. The "official" way of dealing with this is to either use an image button (<input type="image" src="button.png" alt="Ok" />
) or put the image in a button
element (<button><img src="button.png" alt="Ok" /></button>
).
However if the graphic you want to show instead of the button is part of a sprite image, or if you want to display a different image when the button is hovered over or receives focus, that won't work. In these cases it can be tempting to just use a background image and move any text the button contains out of the way by positioning it off-screen or applying a bit of text-indent. Or even worse, use no text content at all. Using no text content at all is obviously no good to anyone who can't see the image, like screen reader users. And hiding the text causes problems if the image can't be displayed.
Much of this is covered by Nicholas C. Zakas in Making accessible icon buttons, and I thought I'd talk a bit more about a technique he mentions that I use in these situations – the transparent one pixel image.
Posted in CSS, Browsers, Accessibility.
Copyright © Roger Johansson
Здесь можно оставить свои комментарии. Выпуск подготовленплагином wordpress для subscribe.ru
No comments:
Post a Comment