设置< select multiple>中显示的选项数量元素小于4 [英] Set number of options shown in a <select multiple> element to less than 4
问题描述
< select size="2" multiple>
< option value="1">1< /option>
< option value="2">2< /option>
< option value="3">3< /option>
< option value="4">4< /option>
< option value="5">5< /option>
< option value="6">6< /option>
< option value="7">7< /option>
< option value="8">8< /option>
< option value="9">9< /option>
< option value="10">10< /option>
< option value="11">11< /option>
< option value="12">12< /option>
< option value="13">13< /option>
< /select>
选择标记的大小属性在Safari中无法正常工作。
size attribute of Select tag is not working properly in Safari.
如果size属性的值大于4,则没有问题,它的工作原理。
但是当我设置大小小于4的值时,它会显示四个值。
if size attribute's value is greater than four then there have no problem, its working. But when I set the value of size less than four then it show four values.
上面的示例显示了safari中的四个选项,但我想要两个选项。
这是什么原因?
above example displays four options in safari but I want two options. What is the reason for this ?
推荐答案
我不确定原因是什么,但你可以风格使用 height
的元素。不幸的是,这使得在每个浏览器中看起来相同都很尴尬,尽管下面的示例看起来足够接近:
I'm not sure what the reason is, but you can style the element using height
. Unfortunately, this makes it awkward to get it to look the same in each browser, although the example below looks close enough:
这篇关于设置< select multiple>中显示的选项数量元素小于4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!