css中的select怎么控制高度?

html-css015

css中的select怎么控制高度?,第1张

css设置下拉列表select样式,首先需要获取到这个元素的id或者是class,然后在通过给这个元素设置它的width和height等等一些样式,具体的看代码:

<html>

<head>

<style>

.div1{

width:600px

height:200px

font-size:13px

}

.div select{

width:200px

}

.div select option{

width:150px

height:30px

}

</head>

<body>

<div class='div1'>

<select>

<option value="volvo">Volvo</option>

<option value="saab">Saab</option>

<option value="opel">Opel</option>

<option value="audi">Audi</option>

</select>

</div>

</body>

</html>

只有多行select框才可修改height值,单行select是不能改变高度的。

比如下面的就可以:

<select style="width:300pxheight:200px" multiple>

<select style="width: 200pxheight:22pxline-height:18pxpadding:2px 0" name="application">

可以尝试用行高加内边距的方法来设置.