Home arrow Style Sheets arrow Taming the Select
STYLE SHEETS

Taming the Select


So, having a good time with SELECT? Probably not. That's why today, Chris Heilmann will be teaching you the ups and downs of making things look the way your client wants things to look. After all, you do want to get paid, don't you?

Author Info:
By: Chris Heilmann
Rating: 4 stars4 stars4 stars4 stars4 stars / 50
November 15, 2004
TABLE OF CONTENTS:
  1. · Taming the Select
  2. · DOM to the rescue
  3. · But wait, there is more!
  4. · The Script

print this article
SEARCH DEVARTICLES

Taming the Select
(Page 1 of 4 )


Support File Available Here


Of all the form elements in HTML, SELECT is the enfant terrible. It behaves nicely when kept as is, but as soon as we try to teach it some style manners, it'll go ballistic on us. Some browsers allow for border, others allow for a different font, some just don't allow any styling at all.

Partly this is our own fault; we shouldn't try to redesign form elements to blend into the page design. Users know their form elements and know what to do with them, if we change the look of the elements, they will have to adapt. Form elements cannot be recognized subconsciously any longer - the user has to find them. It is up to us to decide if we can afford that.

That being true, we will still have to redesign form elements, as the design or the client dictates it, and we want them to pay us. It doesn't hurt mentioning the drawbacks, though.

Styling the select

One of the most designer-annoying features of SELECTs is that they are as wide as their longest option. We cannot force them to have a certain width and make the options wrap. Most browsers will cut off options that are longer than the defined width, something that may render them useless.

Taming the Select

Example of how different browsers render a styled select with a fixed width


blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Padding Overview
- CSS: Margins Overview
- Top CSS3 Button Tutorials
- More Top CSS3 Tutorials for Animation and Im...
- CSS Mega Menus: Adding Extra Sections
- CSS Mega Menus
- CSS3 Accordian Menu: Horizontally Display Hy...
- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials