html - 如何在html中像表格一样改变div的方向

标签 html css css-tables

我需要将我的 div 标签的方向更改为像表格一样从右到左。 当我们改变表格的方向时,它会改变列的顺序。 我需要在 div 标签上执行此操作。当我切换到其他语言(如 波斯语、阿拉伯语...)时,此操作是必要的,然后布局需要将它们的位置从从右更改为左

这是我的代码:

<div style="direction: rtl; display: block; ">
    <div style="display: inline">
        My</div>
    <div style="display: inline">
        name</div>
    <div style="display: inline">
        is</div>
    <div style="display: inline">
        mojtaba</div>
</div>

请注意,在我使用 display:tabledisplay:table-cell 之前,它完全符合我的要求,但此代码的问题仅限于某些新版本浏览器为 http://www.quirksmode.org/css/display.html表示。因此,我需要以某种方式想出一种方法来修复上述代码。

最佳答案

Old-school-no-CSS 在 HTML4 中仍然有效。我认为也在 HTML5 中......使用它:

<table dir="rtl">
 ...
</table>

关于html - 如何在html中像表格一样改变div的方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9963104/

相关文章:

css - 如何制作 float :left go all the way left regardless of the height of the previous elements?

javascript - 在每页上打印页码,如 1 of 4 print

javascript - 文档查询选择器实现的问题

php - 宽度 100px 之前 span i 类 Font Awesome

html - Chrome 和 Safari 没有渲染我的表格以适应其内容

html - 如何使用CSS样式化递归目录?

html - 样式化 div 悬停 Action 不移动其他元素

javascript - 弹出窗口显示左下角而不是鼠标位置

javascript - 使用 jquery 检测移动到另一个 html 元素上的 html 元素

javascript - 将 Css 转换为 jQuery