tags:

views:

170

answers:

1

I have been able to control the width of the option etc.

However, you know that the selected option gets highlighted by making background blue and text-color white by default. That blue background is not covering the entire width of the selected option. The blue background is covering the entire text though. However, I would like it to cover the entire width of the option.

See this image to know what I mean:

http://img69.imageshack.us/img69/2752/dropdowno.jpg

This is how I am setting width of the option and select

option
{
    width:100px;
}
select
{
    width:100px;
}
+1  A: 

I'm sorry to say that most browsers won't allow you to do this; forms remain very difficult to style. The background can't extend the full width of its parent element because the browser takes the width of the element's scrollbar into account (regardless of whether or not it's actually there).

You could use Javascript to render replacements that may be styled to your heart's content, however, and there are a great many ways to do it. If you're using jQuery, you might want to look into this compilation of plugins.

Johannes Gorset
Yep, beat me to it ;-) This occurs in Firefox and has been for years. If you try it in Internet Explorer you wont see the issue. :-)
Russell Giddings
I believe it is also the case with Safari, Opera and other browsers that don't suck (then again, one could argue that IE somehow has this one right). :-)
Johannes Gorset