Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical Alignment of text in a table cell

Tags:

html

css

Here's a portion of my table (it's a form):

Those are just two <td>'s in a <tr>. I'm trying to get Description up top, to the top of the table cell, rather than resting on the bottom.

How can I do that?

like image 385
AKor Avatar asked May 09 '11 22:05

AKor


People also ask

How do I align text vertically in a table-cell in Word?

1 Select the text you want to center between the top and bottom margins. 2 On the Page Layout tab, click the Page Setup Dialog Box Launcher. 3 Select the Layout tab. 4 In the Vertical alignment box, click Center 5 In the Apply to box, click Selected text, and then click OK.

Which attribute is used for vertical alignment of text in cell of a table?

The HTML <td> valign Attribute is used to specify the vertical alignment of text content in a cell.

What is vertical alignment of text?

Vertical alignment determines the position of the text within a section of a document relative to the top and bottom margins, and is often used to create a cover page.

Which alignment aligns the text to the vertical middle of the cell?

You can also define vertical alignment in a cell, similar to how it is done for horizontal alignment. In vertical alignment, information in a cell can be located at the top of the cell, middle of the cell, or bottom of the cell. The default is bottom.


1 Answers

td.description {vertical-align: top;} 

where description is the class name of the td with that text in it

td.description {    vertical-align: top;  }
<td class="description">Description</td>

OR inline (yuk!)

<td style="vertical-align: top;">Description</td>
like image 73
clairesuzy Avatar answered Sep 20 '22 02:09

clairesuzy