CSS Test Request

Messages
2,097
Edit My Images
No
Hey all,

Can someone test the following CSS so I can verify that it works correctly please? The aim is to have centered content on any given page size by automatically aligning the div tag both vertically and horizontally. It works on Firefox (Linux) so if you could spare the time and test it on your machine it would be much appreciated as I don't have a live domain to test it on.

html, body {
height:100%;
}

#centeredcontent {
width:400px;
height:50px;
text-align:center;
color:#CCC;
position:absolute;
left:50%;
top:50%;
margin-left:-200px;
margin-top:-25px;
}

Here's the HTML so you can just copy and paste:

<html>

<head>

<title>V / H Align</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel=StyleSheet href="css.css" type="text/css">



</head>


<body>

<div id="centeredcontent">Coming Soon!</div>


</body>



</html>

Thanks,

KB.
 
sweet looks like it works :). Took me an age to figure out how to do that in CSS. I wanted to get away from JQuery / Javascript to align the page where I wanted it.

Thanks for putting that up for me. Much appreciated.

Does this work for everyone else (the vertical / horizontal alignment in any given page size)?
 
Works on the iPhone ;)
 
IE8 and Chrome - OK!
 
Lovely, thanks for the feedback.

Its amazing how long it took me to figure out that alignment thingy'me'bob in CSS.
 
Back
Top