View Single Post
Old 10-21-2003, 05:37 PM   #32 (permalink)
Distorted
Inactive
 
Join Date: 10-13-03
Posts: 275
iTrader: 0 / 0%
Latest Blog:
None

Distorted is on the right pathDistorted is on the right path
To align it vertically with css you could use the vertical-alignment attribut, which doesn't work too well, or you could do it like this:

[code:1:9b338bdf76]
<html>
<head>
<title>Aligning with CSS</title>
<style type="text/css">
.aligned
{
position: absolute;
margins: auto auto;
top: 50%;
bottom: 50%;
height: 500px;
width: 500px;
border: 1px solid black;
text-align: center;
}
</style>
</head>
<body>
<div class="aligned">
Blah
</div>
</body>
</html>
[/code:1:9b338bdf76]

To do this, I just used absolute positioning to put it 50% from the top and bottom. I've only tested it in IE 6, so I'll test it else where now.

I've also noticed that text-align: center; only applies to whatever is inside of the div, while the margins affect the entire div. So, maybe you could use text-align: center; with other browsers, besides IE, if you nest divs.

*Goes off to experiment*
Distorted is offline   Reply With Quote