将height属性分配给选项标签 [英] Assign height property to option tag

查看:101
本文介绍了将height属性分配给选项标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为我的选择内的选项标签设置更大的高度.

I need to set a bigger height for the option tags inside my select.

<select name="forms" id="forms">
    <option value="1">Row 1</option>
    <option value="1">Row 1</option>
    <option value="1">Row 1</option>
</select>

为此,我使用了下面的CSS代码,但这没用.

I used the CSS code below for this purpose, but it did not work.

option {
   padding-top:5px;
   padding-bottom:5px;
}

我也对此进行了测试,然后又发生了任何事情.

Also I have tested this one, and again, anything happened.

option {
    height:20px;
}

您有什么建议?

推荐答案

我可以使用select标签的样式为它设置一定的高度:

I could set a certain height for it using a style for the select tag:

<select name="" style="height:25px">

这篇关于将height属性分配给选项标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆