Html 右对齐表格?
此代码:Html 右对齐表格?,html,css,html-table,Html,Css,Html Table,此代码: <table border="1"> <tr> <th>a</th> <th>b</th> <th>c</th> <th>d</th> </tr> </table> 如何使其生成: d | c | b | a ? 而不改变的顺序 <table border
<table border="1">
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
</tr>
</table>
如何使其生成:
d | c | b | a
?
而不改变<table border="1">
<tr>
<th>d</th>
<th>c</th>
<th>b</th>
<th>a</th>
</tr>
</table>
D
C
B
A.
希望我没有误解你的问题。
<table border="1">
<tr>
<th>d</th>
<th>c</th>
<th>b</th>
<th>a</th>
</tr>
</table>
D
C
B
A.
添加cssth{float:right}
。这将颠倒顺序,因为将从包含d
的第一个th
开始,并将其向右浮动,然后是第二个,依此类推
演示:您可以将dir=“rtl”
属性添加到表中:
<table border="1" dir="rtl">
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
</tr>
</table>
A.
B
C
D
演示:
(尝试将其添加到
tr
,但未成功)dir
,或方向:
用于处理双向现象
<table border="1" dir="rtl">
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
</tr>
</table>