html - div 中的垂直对齐下拉列表

标签 html drop-down-menu vertical-alignment

如何在已知宽度和高度的 div 中放置已知宽度的下拉菜单?垂直对齐对我没有帮助。

    <div id="wrapper">
       <select id="dropdown" ></select>
    </div>

    #wrapper{
       border-style:solid;
       height:100px;
       width:200px;
     }

    #dropdown {      
      vertical-align:middle;
      width:80px;
    }

这里是 jsFiddle .

最佳答案

#wrapper {
    border-style:solid;
    height:100px;
    width:200px;
    display:table-cell;
    vertical-align:middle;
}
#dropdown { 
   width:80px;
}

关于html - div 中的垂直对齐下拉列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14042128/

相关文章:

html - 选择选项 *selected* 属性在 chrome 中不起作用

html - 如何使子 div 沿父 div 的每一侧居中

html - % 高度的行高

css - Bootstrap 下拉列表的堆叠问题

php - Slick Carousel 中的垂直对齐图像

html - 我如何管理那些 <p> 和 <div> 元素的位置,以便它们按我需要的方式显示?

html - 调整 SideBar 的位置,使其位于 NavBar 固定顶部的 "front"

html - 渐变以适应不同的 div 大小

javascript - 灯箱弹出窗口仅出现一次

asp.net-mvc - 如果在 for 循环中,DropDownListFor 不会选择值