在css样式中加入:direction: rtl ,即可让文字从右向左排列,但此时符号的排列位置不正确,会显示在文本的最左边。
如:hello,world! 会变成:!hello,world
解决方式
1、在文本的末尾加入特殊符号 “ ‎ ”
<div class="container">Hello, World!‎</div>
2、使用行内元素(span)包裹着文本,并且为内联元素设置样式:{ direction: ltr; unicode-bidi: bidi-override; }
<html>
<head>
<style type="text/css">
div.container
{
direction: rtl;
}
.text {
direction: ltr;
unicode-bidi: bidi-override;
}
</style>
</head>
<body>
<div class="container">
<span class="text">Hello, World!</span>
</div>
</body>
</html>
原文链接:
https://blog.youkuaiyun.com/qq_41555989/article/details/115028360