Thursday, August 4, 2011 - by

Until about 2 years back whenever there was a splash page to be created that needed the contents to be vertically and horizontally centered also knows as the “Letterbox Effect” I always used to take refuge in absolutely positioned container. By having the container absolutely positioned I could take advantage of “top”, “left” & negative “margin-top” & “margin-left” CSS properties as shown in the code below:

 CSS |  copy code |? 
01
.container { 
02
position:absolute;
03
width:500px; 
04
height:300px;
05
top:50%;
06
left:50%;
07
margin-top:-150px; 
08
margin-left:-250px;
09
background:#ccc;
10
}

Read more »