如何垂直对齐下拉列表?

时间:2015-04-20 20:06:03

标签: html css

如何将文本和下拉列表垂直居中以使它们保持水平?

<p>
<span>Hello World</span><select><option>Hello</option></select>
</p>

span {
    font-size: 50px;
}

https://jsfiddle.net/foaLrcn9/2/

1 个答案:

答案 0 :(得分:2)

只需将两个元素的vertical-align property更改为middle

Updated Example

span, select {
    vertical-align: middle;
}

span {
  font-size: 50px;
}
span,
select {
  vertical-align: middle;
}
<span>Hello World</span><select><option>Hello</option></select>