It's been long time that I don't make a website and I can't remember how to align vertically a div in a proper way. I checked many online resources and also stackoverflow questions but nothing helped or at least I didn't see where my mistake is.
I created a text that at the beginning is hidden and after some time appears and scales getting bigger using jQuery. It seems to work and it is centered horizontally but not vertically. How to align it vertically to the center of the page?
HTML
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<link href="main.css" rel="stylesheet" />
<title>Homepage</title>
<script src="jquery-2.0.3.min.js"></script>
</head>
<body>
<div id="container" align="center">
<p id="robo">ROBO</p>
</div>
<script>
$(document).ready(function() {
$("#robo").delay(500).fadeIn(500).animate({fontSize: "3em"}, 1000);
});
</script>
</body>
</html>
CSS
*{
margin: 0px;
padding: 0px;
}
body {
text-align: center;
width: 100%;
}
#container {
width: 1024px;
height: 768px;
margin: 0 auto;
}
#robo {
display:none;
width:200px;
height:200px;
}
JSFiddle Example: http://jsfiddle.net/sMrL9/