soooo我似乎无法获得一些div对齐工作。基本上,我有一个容器div,并且我想要div内的左列和右列,基本上右列总是会比左列纵向更大。所以我想让左栏垂直居中右栏。这里是我的CSS:css div对齐,顶部:50%不工作
.recipe_container{
float:center;
width:800px;
position:relative;
padding:0px;
border:5px solid #B22222;
margin:0px auto;
}
.recipe_container_left{
float:left;
width:390px;
position:relative;
top:50%;
padding:4px;
border-right:1px solid;
margin:0px auto;
}
.recipe_container_right{
float:right;
width:390px;
position:relative;
padding:4px;
border-right:1px solid;
margin:0px auto;
}
和HTML坐落像这样
<div class="recipe_container">
<div class="recipe_container_left">
recipe title and ingredients
</div>
<div class="recipe_container_right">
recipe cooking instructions
</div>
</div>
,但左边的 “recipe_container_left” DIV不垂直居中父 “recipe_container” DIV中。我一直在Google上搜索一下,似乎无法获得任何工作。我知道,新手问题。任何帮助?
喜欢这就是我想要的结果(即动态地扩展到浏览器窗口中的一些):
------------------------------------------------------------
recipe_container ============================
| |
| recipe_container_right |
=========================== | recipe cooking- |
| recipe_container_left | | -instructions |
| recipe title+ingredients| | |
| | | |
=========================== | |
| |
| |
============================
------------------------------------------------------------
(repeat)
我不明白你在找什么。你能画一幅画并附上它吗?我们可能能够更好地帮助您 –