Home arrow Style Sheets arrow Page 3 - 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 - But wait, there is more!
(Page 3 of 4 )

Another reoccurring requirement by clients are SELECT navigations.

SELECTs are nice for navigation; they don't take up much screen estate and can be extended and reduced easily without shifting the other content out of the visible screen area.

We can create a perfectly accessible navigation with a select, if only we offer a non-JavaScript fall-back and a button to submit the form.

Alas, design restrictions and requirements by the client might force for us to get rid of the button. This means that users without JavaScript cannot submit the form any longer, which also renders our backend fall-back useless. To navigate, we need to use JavaScript called via an onchange handler on the select.

If we use the keyboard for navigation and we tab to the select, some browsers will try to navigate to the next option immediately when we hit arrow down. Experienced keyboard users will know though that you have to hit alt+arrow down first to expand the whole drop-down.

We can point these problems out to the clients, but chances are that we cannot persuade them to comply with our idea of the need for "that ugly button". They saw (or even created) the design and this is exactly how it should look like, for good or for worse.

Reversing the thinking process

We need to ensure that the select without the button only appears when JavaScript is available. Furthermore, we don't want to use a fall-back solution on the backend, as it means double maintenance, and we might not be able to offer it.

What we can do is use DOM to take a perfectly accessible and semantically clean navigation like a list of links, and turn it into a SELECT navigation when JavaScript is available.

This is also covered by the example script. If you look at the source of the example page, you see that the list of links with the class turnintoselect is turned into a SELECT navigation.

The script was tested on Internet Explorer 5, 5.5, 6, Opera 7.5 and Firefox 0.9 on windows. You can download it together with the demo page and see where else it can perform its magic.


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