CSS3中提供了多种新的属性,可以实现文字从左到右的显示效果。/ 设置文字方向为从左到右 / textdirection: rtl; / 设置文字对齐方式为从右向左 / textalign: righ...
CSS3中提供了多种新的属性,可以实现文字从左到右的显示效果。
/* 设置文字方向为从左到右 */
text-direction: rtl;
/* 设置文字对齐方式为从右向左 */
text-align: right;
/* 设置文字排版方式为竖排 */
writing-mode: tb-rl; 通过以上三个属性的方便组合,可以实现文字从左到右的效果。
具体应用可以参考以下代码:
<html>
<head>
<style>
.right-to-left {
text-direction: rtl;
text-align: right;
writing-mode: tb-rl;
}
</style>
</head>
<body>
<p class="right-to-left">
此处显示从左到右的文本。
</p>
</body>
</html> 以上代码中,我们使用了class选择器,将所需属性应用到了一段文本之中。
通过这种方法,可以实现一些特别的排版效果,让网页看起来更加有趣。