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?
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
try
table td { vertical-align:top; float:left }
Reference:
vertical-align
float
@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;
}
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
精彩评论