The HTML SELECT format changes depending on the option selected

I have this problem that got me thinking about a hole and I can't figure out what the matter is:
I have a SELECT element , with parameters of different sizes ,
Obviously the default is the size of the longest option.
But when I select one or more options, the selection window changes its size ,
I do not know what can cause this behavior because it only happens in Firefox and in all elements SELECT my application. Is there a CSS property to make this happen?
Do you have any ideas? thanks in advance

+3


source to share


3 answers


I found what was the
problem.In fact, since this is an old application, I found several reset css applying this rule:

* {
 padding: 0;
}

      



It looks like only firefox doesn't like this, and so applying this to an element does this side effect.
I figured it would give my tags a padding style to override the reset style.

0


source


You need to specify the select

width of the set in your stylesheet. Without it, it will behave as you describe.

select{
    width:200px;
}

      



Also, if you want it to keep the size, but only up to a certain size, you can use max-width

instead.

select{
    max-width:200px;
}

      

+2


source


It looks like the lack of CSS width is causing the auto-sizing of the window. Try adding CSS width

or min-width

.

0


source







All Articles