开发者

How do I align something in a <td> in the top-left corner - without aligning everything?

Say I have something that looks like this: http://jsfiddle.net/Dtsjh/

How do I align the numbers in each cell to be in the top-left corner of each cell - without aligning the words?

Preferably in just HTML/CSS - but i开发者_如何学Gof you can't do it any of those, then jQuery is fine.


td {
vertical-align: top;
text-align: left;
}

put the above css for the row of the table..And it works. If you want specific to that td, put the id of the td in css.


Wrap the number in a <span>, float it to the left, and give it a negative top margin to push it up into the corner: http://jsfiddle.net/ambiguous/chp8y/

You'll have to fiddle with the pixel values on the .sit-in-the-corner margins to get something that works for you.


In the TD tag you can use the align="left". Inside of the style attribute you can also try and add a horizontal alignment or text-alignment:left. Try to add a div, and a span inside a div for some more complex alignment with the style attribute style="text-align:left;".

see link: link text

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜