/ Published in: CSS
In modern browsers select options can now be style using most css properties. Of course, IE is still behind but it does support some styling as well. There are a lot more options on the site.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function setposition() { algset = new Array('left','right','center'); sel=document.getElementById('theselect'); sel.style.backgroundColor='blue'; sel.style.textAlign='center'; sel.style.color='orange'; for (i=0;i<sel.options.length;i++) { if (i%2 ==0) { clr='white'; bclr='green'; } else { clr='navy'; bclr='orange'; } sel.options[i].style.color=clr; sel.options[i].style.backgroundColor=bclr; sel.options[i].style.textAlign=algset[i%3]; } }
URL: http://coboldinosaur.com/pages/Styling_Options_for_Options.html