This i开发者_如何学Pythons my actual code :
<div class="main_right_content">
<div class="main_right_content_text">
my text is here and could be as long as possible. for example I write this code some times : my text is here and could be as long as possible. for example I write this code some times : my text is here and could be as long as possible. for example I write this code some times
</div>
<a class="main_right_content_link" href="#">Go</a>
</div>
And I'd like, when I minimize the window, put the link "go" in the middle about vertical align. In fact it stay always in top.
How can I do this with css(2)?
You can use position: relative
on the container div
combined with position: absolute; right: 0; top: 50%; margin-top: -<height/2>px
on the link.
See: http://jsfiddle.net/mGJtu/22/
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;
}
精彩评论