开发者

HTML table column align right

I have a table with 3 columns. I want that the third column is aligned to the开发者_StackOverflow right of the upper element and the other 2 columns to the left, like this:

(left column) (middle column)                                      (right column)

Is there a way to do this via CSS or something?


Use width:100% on the table and the middle column.


there are a few ways to do what you want. The most basic is to change the alignment directly in the tag

<td align='left'>data1</td><td align='right'>data1</td><td align='left'>data1</td>
<td align='left'>data2</td><td align='right'>data2</td><td align='left'>data2</td>
....

if you need to change something else (css style) you could create a class like .firstColumn and .secondColumn on each <td>

i tried to change directly the column but that doesn't work (HTML table colgroup element not working?


<td style="text-align:right;">data1</td>

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜