How to achieve vertical align of div
I have one div with id="content". It is inside body and contain all data on side.
<body>
<div id="content">
</d开发者_StackOverflow中文版iv>
</body>
How to achieve vertical align of this div ? I tried with vertical-align:middle; in style but it doesn't work. Can anybody help ?
you may get idea form here:
<div id="t01" class="tag">
<div class="small">
<div class="globe-arrow"></div>
</div>
</div>
.tag {background: none repeat scroll 0 0 red;
display: block;
height: 400px;
left: 50%;
margin-left: -200px;
margin-top: -200px;
position: absolute;
top: 50%;
width: 400px}
.small { background: none repeat scroll 0 0 #EBEBEB;
height: 300px;
left: 50%;
margin-left: -150px;
margin-top: -150px;
position: absolute;
top: 50%;
width: 300px;}
its easy you can use this:
#content {
margin: 0 auto;
width:960px;
position:relative
}
This Solution Matched me perfectly. Even if it is a link or just a text inside the div, this CSS Class could vertically align the content inside the DIV
.verticalCenterDivText{
height: 29px;
line-height: 29px;
}
精彩评论