Is there a way to vertically center content in a table cell using CSS
(not HTML)?
Sam
__
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported
Is there a way to vertically center content in a table cell using CSS
(not HTML)?
A CSS table cell or an HTML table cell?
CSS:
[assume markup - div class=vcenter]
.vcenter {display: table-cell;vertical-align: middle;height: 100%;}
HTML:
[assume markup - td class=vcenter]
.vcenter
okay, so slightly OT here... could someone explain the use of
display:table-cell?
I can never seem to get my brain around the how's and why's
Like, why wouldn't you use a table instead of divs acting like tables
and table cells?
thanks!
Is there a way to vertically center content in a
CJ Larson wrote:
Is there a way to vertically center content in a table cell using CSS
(not HTML)?
A CSS table cell or an HTML table cell?
This is a td cell
CSS:
[assume markup - div class=vcenter]
.vcenter {display: table-cell;vertical-align: middle;height: 100%;}
This doesn't
This doesn't seem to center vertically in either IE 6 or Firefox...
Do you have a sample page online?
I noticed you cut out the HTML td example from my original reply and
only left in the CSS one. Are you sure you were using the right
example? The full code for my td table was more like this
Why do you need this
style=height: 100%;vertical-align: middle;
at all?
Isn't the default for vertical alignment in a cell
center? If you don't do anything, and haven't set
anything in your CSS, the cell should be vertically
centered by default.
Marjorie MacDonald
--- CJ Larson [EMAIL