I have a div like this:
<div class="first">
<img src="image/image1.gif" style="width:30%;display:inline-block"/>
<img src="image/image2.gif" style="width:30%;display:inline-block"/>
<img src="image/image3.gif" style="width:30%;display:inline-block"/>
<br />testing<br /><br />がらんどう
</div>
I want it to vertically center and resizable so I use standard JQuery code:
$(window).resize(function(){
$('.first').css({
position:'absolute',
top: ($(window).height() - $('.first').outerHeight())/2
});
});
$(window).resize();
The css for the div is like this:
.first
{
position:absolute;
top:50%;
}
The problem is: The div is not vertically centralized upon loading, but when u resize the window, it will be centralized..
Can you guys help me figure out? Thanks!!