Set tag's size attribute through css?

2019-01-27 13:36发布

Normally you can do this:

<select size="3">
    <option>blah</option>
    <option>blah</option>
    <option>blah</option>
</select>

And it would render as a selectionbox where all three options are visible (without dropping down)
I'm looking for a way to set this size attribute from css.

7条回答
唯我独甜
2楼-- · 2019-01-27 14:08

I disagree, I have been able to set select width and height using CSS with something like this:

select { width: 5em; height: 5em; }

Works in IE(7) as well as I just tested it.

查看更多
登录 后发表回答