Aaron Gustafson is putting together a series of articles on how to make select elements stylable. In essence, what his work does is take the select out of the DOM and replace it with a ul, and then add script and CSS to make that ul work like a dropdown list. The advantage this gives is clear to everyone who’s ever complained about how selects aren’t stylable! The series has only just started, and there are a few concerns — the new element can’t be tabbed to, and doesn’t respond to keyboard events — but Aaron promises that part 2 will cover accessibility issues.

The script uses similar techniques to the Suckerfish dropdowns, applying “hover” and “selected” classes to various parts of the ul to provide hooks for styling (since IE doesn’t support :hover on things that aren’t links). This should be a useful technique to watch!

Stuart Langridge has been a Linux user since 1997, and is quite possibly the only person in the world to have a BSc in Computer Science and Philosophy. He’s also one-quarter of the team at LugRadio, the world's premiere Free and Open Source Software radio show. Tony Steidler-Dennison is a Systems Engineer with Rockwell Collins, Inc., designing avionics and cabin data servers for commercial airliners. He’s also the host of The Roadhouse Podcast, "the finest blues you've never heard."

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.

  • http://www.deanclatworthy.com Dean C

    Thanks for the heads up Stuart, I wonder what browsers it’ll be compatible with *wonders off to read*

  • http://nathanwwong.com someonewhois

    He didn’t add a document.onclick=”hide the menu”, so if you click the drop down and then click somewhere else, it doesn’t disappear. Other than that, cool.

  • http://www.lowter.com charmedlover

    Ick! It doesn’t even work in Opera. I hate Firefox only coders…

  • Andy

    Works fine here in Opera (7.51), Firefox and IE.

  • http://www.realityedge.com.au mrsmiley

    Would be nice if it layered over the top of the form rather than taking up space in the page flow when its expanded.

  • schallm

    Looks great, but I would agree with mrsmiley. Also, keyboard support is a must. Should be able to tab to the control and select with keyboard.

  • http://www.qreyes.com/ QReyes

    Very stylish! :D Would be nice to read about the accessibility issues.

  • http://icant.co.uk codepoet

    Interesting, I published a similar piece some time ago:

  • http://www.goportal.info davidvogt

    Your article is very informative and helped me further.

    Thanks, David

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.