PDA

View Full Version : Verticially centering content


beetle
08-09-2002, 07:10 PM
within a DIV. I can set the padding top and bottom to 'fake' vertical centering, but I don't know (and can't find) the proper attribute for this.

boxer_1
08-09-2002, 07:23 PM
How about this:

<html>
<head>
<title>Example</title>
<style type="text/css">
.blah {
text-align: center;
vertical-align: middle;
}
</style>
</head>
<body>
<div class="blah">
Content centered in div...
</div>
</body>
</html>

Is this what you were looking for?

beetle
08-09-2002, 07:36 PM
Um, no because text-align does horizontal centering, and vertical-align aligns the object within it's container, not the content within the object, right?

boxer_1
08-09-2002, 07:41 PM
Sorry, mis-understood your question :o .

Edit: Do you have a link to the page where you're having this problem? What, did you assign a height to your div (not valid as far as I know)? I guess I'm not understanding the purpose of this. <div align="center"...will center your text horizontally, the div will expand in height to accomodate the content :confused: