开发者

Is it possible to set Select element width in percentage?

I have a select element in an HTML page, I'd like to set its width to 100% (via CSS) but it doesn't work and the width only changes according to the width of the longest optio开发者_如何学Gon. Only when I set a width in pixels, it works.

Is it possible to set the width in percentage? or is there a workaround?


Check the parent element like where your select option is there. The width of the parent element is the constraint for the child. You need to increase the width of the parent first.


Works for me here: http://jsbin.com/eraru

select {
    width: 100%;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜