How can I align my text with CSS so that it appears at the top of the table?

I'm a little confused. Should I use a top or text top? I found a link to both, but I'm not sure what to use. All I have is a simple table with two rows and two columns. I would like the text to be aligned at the top and left of each cell. What is the easiest way for me to do this? Can I do this without a lot of CSS and use inheritance?

+3
source share
4 answers

In your css file, configure the td style and add vertical-align: top;
This will align all data between and at the top of the table and align left

+1
source

table td { vertical-align:top; float:left }

:

vertical-align

float

+1

@TonyG; jsfiddle , .

, :first-child, :last-child nth-child().

td:nth-child(1){
    vertical-align: top;
}
+1
source

All you have to do is add vertical-align: top;to the styles td.

Here is a very simple example: http://jsbin.com/usego3/2

0
source

All Articles