Skip to Content


Public news / May 2007 / Sliding Buttons

Sliding Buttons

A cross-browser technique for styling the button element with sliding doors.

permanent link 23 may at 19:21 by Jon

There are 4 guest comments so far.

commentat 13:22 on 25 May 2007, Tom wrote:

Too bad it doesn't scale vertically, rendering this technique practically useless. Unless your button text never wraps and you don't care about those people who increase their text size.

commentat 18:00 on 25 May 2007, Brent wrote:

Seems a little bloated. If you have to add js to it, you might as well just style a regular link with an onclick event (using another bloated unobtrusive script of course).

commentat 18:19 on 25 May 2007, Scott wrote:

Tom: Good point, but it could scale vertically if you added another wrapper or two. We didn't feel it was necessary to demonstrate a 4-way scale in a tutorial that was more about getting the button element to work with basic sliding doors. The font size on this button is large as it is but it will still fit in the button after 2 increments larger (though a different line-height scheme would help to keep it v- centered).

Brent: 1 span doesn't seem very bloated as a trade-off for consistency in styling and control across all buttons on a site. JS is only optionally needed for a hover style in IE, which would be true of any non-anchor element. The advantage over simply scripting an anchor though, is the button element will still submit the form without JS. In that category, we're only left with an image input or button el.

Of other alternatives out there, this one certainly makes things easy to maintain with minimal trade-offs. Like any technique, you'd want to fit it to your n

commentat 18:23 on 25 May 2007, scott wrote:

cut-off..

...fit it to your needs.

also, that's ie6 for the hover js... 7 is fine without.

Add a comment:

(required, non-public)

  |  Chars left: 1000

Keep the comment relevant, constructive and be polite.
A valid email address or URL to your site must be provided, or the comment might get deleted. Content seemed inappropriate or offensive may be edited and/or deleted. Avoid explicit language and words such as "sucks" and "ripoff". For more in-depth discussions use our forum. Email addresses are never displayed. Line breaks and paragraphs are automatically converted - no need to use <p> or <br/>. Quotes & apostrophes are automatically converted to smart punctuation. Be careful when copying and pasting portions of entries or other comments. The following inline HTML elements may be used: <strong><em><pre><q><blockquote><code>. All other code will get removed before posting. Don't forget to close your tags.


Search the archive

Stylegala news archive

Public news archive

News contributors


Features

Stylegala BookStore
The Stylegala BookStore has a massive archive of great books for you as a professional..
Bullet madness
Bullet madness is a list of 200 bullets, arrows and icons uploaded by our users.
CSS Reference
An alphabetical list over the most common CSS1 and CSS2 syntax and properties.

Sponsors

Logo design for $149

Advertise here