CSS direction 属性
设置文字方向"right-to-left":
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
div.ex1 {
direction: rtl;
}
</style>
</head>
<body>
<div>一些文本。默认的书写方向。</div>
<div class="ex1">一些文本。 Right-to-left 方向。</div>
</body>
</html>
属性定义及使用说明
direction属性指定文本方向/书写方向。
| 默认值: | ltr |
|---|---|
| 继承: | yes |
| 版本: | CSS2 |
| JavaScript 语法: | object.style.direction="rtl" |
浏览器支持
| 属性 | |||||
|---|---|---|---|---|---|
| direction | 2.0 | 5.5 | 1.0 | 1.3 | 9.2 |
属性值
| 值 | 描述 |
|---|---|
| ltr | 默认。文本方向从左到右。 |
| rtl | 文本方向从右到左。 |
| inherit | 规定应该从父元素继承 direction 属性的值。 |
相关文章
CSS 教程: CSS Text