打印表格单元格从右到左 [英] printing table cells from right to left

查看:199
本文介绍了打印表格单元格从右到左的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个表,并希望第一个单元格从右开始,而不是从左开始默认。
我试图更改float属性在css,但它似乎没有帮助。
这里是代码

i make a table and want the first cell to start from right instead of from left as default. i tried changing the float attribute in css but it doesnt seem to help. here is the code

<table border="0" width="100%" cellspacing="0" align="center" class="result_table">
    <tr align="right">
    <th bgcolor="#cccccc" align="right">1</th>
    <th bgcolor="#cccccc" size="17">2</th>
    <th bgcolor="#cccccc">3</th>
    <th bgcolor="#cccccc">4</th>
    </tr>; 

</table>
table.result_table {
    float:right;
}

任何人都可以建议改变这个表的浮点数。

can anyone suggest a way to change the float of this table?

推荐答案

如注释中所建议,您可以将方向性设置为从右到左(RTL)。但是,除非您的表内容采用从右到左的语言,否则应另外将表内容元素中的方向性设置为从左到右。否则,它们继承RTL方向性,这将在许多情况下引起惊喜,因为方向性也设置了整体文本的方向性。这不会影响西方语言的正常文本,但会影响例如。内容像4(5),它将显示为具有RTL方向性的(5)4。

As suggested in comments, you can set directionality to right-to-left (RTL). However, unless your table content is in a right-to-left language, you should additionally set the directionality in table content elements to left-to-right. Otherwise, they inherit RTL directionality, which will cause surprises in many situations, since the directionality also sets the overall text directionality. This will not affect normal text in a Western language, but it will affect e.g. content like "4 (5)", which would appear as "(5) 4" with RTL directionality.

因此,您应该设置

table.result_table {
  direction: rtl; }
table.result_table caption, table.result_table th, table.result_table td {
  direction: ltr; }

这篇关于打印表格单元格从右到左的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆