Submitted by: COBOLdinosaur on 2012-08-21 01:46:41
Member Site: http://COBOLdinosaur.com
One of the most versatile and useful elements in HTML is the select. Unfortunately it is also one of the most difficult to style. The worst is trying to get options to accept a little bit of presentation enhancement. A stylesheet is virtually without value. The normal solution is to use Javascript.
The problem is that the browsers treat HTML and CSS as meta data and ignore styling as they create the document object. Javascript can be used to overcome this shortcoming (up to a point) because it extends the DOM without regard to the browser limitation. There are still cross-browser issues (IE is still crappy but even it can be improved. So let's get started.
Click to style the select options The scripting is not very big:
For good browsers we can ... and then ...
will look better with...
Okay you get the idea. Now go out and do it. It's also not bad as a
You can download all the code here



