TonyG
TonyG

Reputation: 1675

How can I line up my text with CSS so it appears at the top of a table?

I am a bit confused. Should I use top or text-top? I found reference to both but I'm not sure which to use. All I have is a simple table with two rows and two columns. I would like the text to be aligned to the top and to the left in each cell. What's the most easy way for me to do this? Can I do it without lots of CSS and use inheritance?

Upvotes: 3

Views: 119

Answers (4)

sandeep
sandeep

Reputation: 92803

@TonyG; Check jsfiddle may be that's you want.

there are different selectors for this type of functionality like :first-child , :last-child & nth-child().

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

Upvotes: 1

xkeshav
xkeshav

Reputation: 54052

try

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

Reference:

vertical-align

float

Upvotes: 1

StephenLembert
StephenLembert

Reputation: 1534

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

Upvotes: 1

derekerdmann
derekerdmann

Reputation: 18252

All you should need to do is add vertical-align: top; to your td styles.

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

Upvotes: 0

Related Questions