views:

35

answers:

2

I am using JQuery. I have a div that contains a table. I have 4 rows in the table each with one col. Each row contains a line or two of text

I want to make each row with height = 100 px and have the text centered horizontally and vertically.

can this be done?

Thanks!

+4  A: 

If you want the text in each table cell aligned vertically and horizontally, you can use CSS.

table td {
    height: 100px;
    text-align: center;
    vertical-align: middle;
}

See it working here.

alex
+1 for letting CSS do the work
irishbuzz
wont this make every td in the page have these properties?
kralco626
updated question.
kralco626
Take that back. I'm going to mark yours as the answer. You answered the question. Problem is I didn't ask the right questions. Thanks!
kralco626
@kralco626 No worries :)
alex
@alex - the solution you provided only works for text. for some reason when I place a label in it does not work. Started new question here: http://stackoverflow.com/questions/3960510/horizonal-and-vertical-alignment-of-label-in-div-in-table-row
kralco626
@kralco626 I answered your new question.
alex
A: 

very simple:

text-align: center;
vertical-align: middle:
oezi