我的外部div是位置:相对和内部div是绝对定位的。顶部和底部定位与自动?
我想设置我的内部div中心垂直对齐,并思考使用top:auto和bottom:auto但它不工作。请告诉我如何做到这一点。
div.Container div.Right
{
width:50%;
float:right ;
border: 01px dashed green;
height:95px !important;
position:relative !important;
}
div.header-search
{
overflow:auto;
display:inline;
border:0px dashed blue;
position:absolute;
top:auto;
bottom:auto;
right:0px;
}
<div class="Right">
<div class="header-search">
<input type="text" class="searchbox" />
<input type="button" class="searchbutton" value="›" />
</div>
</div>
这适用于固定宽度的水平居中元素,但不适用于垂直居中的东西 – Luca