Public news / May 2007 / Sliding Buttons
Sliding Buttons
A cross-browser technique for styling the button element with sliding doors.
There are 4 guest comments so far.
Search the archive
Stylegala news archive
- July 2008 [6]
- June 2008 [46]
- May 2008 [5]
- April 2008 [5]
- March 2008 [3]
- February 2008 [4]
- January 2008 [7]
- December 2007 [3]
- November 2007 [8]
- October 2007 [17]
- September 2007 [12]
- August 2007 [12]
- July 2007 [12]
- June 2007 [11]
- May 2007 [25]
- April 2007 [17]
- March 2007 [19]
- February 2007 [19]
- January 2007 [23]
- December 2006 [15]
- November 2006 [23]
- October 2006 [39]
- September 2006 [29]
- August 2006 [50]
- July 2006 [38]
- June 2006 [29]
- May 2006 [27]
- April 2006 [50]
- March 2006 [38]
- February 2006 [38]
- January 2006 [65]
- December 2005 [45]
- November 2005 [41]
- October 2005 [44]
- September 2005 [46]
- August 2005 [42]
- July 2005 [32]
- June 2005 [36]
- May 2005 [55]
- April 2005 [50]
- March 2005 [37]
- February 2005 [65]
- January 2005 [94]
- December 2004 [61]
- November 2004 [67]
- October 2004 [12]
- September 2004 [1]
Public news archive
- July 2008 [16]
- June 2008 [115]
- May 2008 [126]
- April 2008 [77]
- March 2008 [69]
- February 2008 [80]
- January 2008 [72]
- December 2007 [35]
- November 2007 [54]
- October 2007 [66]
- September 2007 [51]
- August 2007 [65]
- July 2007 [58]
- June 2007 [68]
- May 2007 [87]
- April 2007 [75]
- March 2007 [65]
- February 2007 [62]
- January 2007 [68]
- December 2006 [52]
- November 2006 [51]
- October 2006 [73]
- September 2006 [52]
- August 2006 [85]
- July 2006 [57]
- June 2006 [67]
- May 2006 [103]
- April 2006 [77]
- March 2006 [93]
- February 2006 [99]
- January 2006 [111]
- December 2005 [104]
- November 2005 [83]
- October 2005 [125]
- September 2005 [106]
- August 2005 [94]
- July 2005 [103]
- June 2005 [79]
- May 2005 [79]
- April 2005 [65]
- March 2005 [47]
- February 2005 [35]
- January 2005 [22]
- December 2004 [31]
- November 2004 [37]
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

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.
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).
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
cut-off..
...fit it to your needs.
also, that's ie6 for the hover js... 7 is fine without.
Add a comment:
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.