Home >Web Front-end >CSS Tutorial >The difference between css direction attribute and writing-mode attribute
In css, writing-mode and direction are both used to control the display direction of text, but there are differences between them.
The parameters in writing-mode include lr-tb (left and right - up and down) tb-rl (up and down - right and left). The writing method in Western countries is usually left and right - up and down, but in Asian countries, such as China Ancient poetry is from right to left, and the writing-mode attribute is reflected!
Example:
<div class="mode"> <h3>登鹳雀楼</h3> <p>白日依山尽,<br>黄河入海流.<br>欲穷千里目,<br>更上一层楼。</p> </div>
.mode{ writing-mode: tb-rl; } p{ font-size: 24px; }
The effect displayed:
##direction parameters ltr (left to right) and rtl (right to left) . Use direction to control whether the writing direction of text is from left to right or right to left. First of all, In css, writing-mode and Direction is used to set the way text is displayed. The two have some similarities and essential differences. Let’s first introduce the usage of the two: writing-mode Syntax:writing-mode : lr-tb | tb-rlParameters:
lr-tb: left-right, top -Down
tb-rl: Top-Down, Right-Left
Set or retrieve the inherent writing direction of the object's content block. Western languages do use left-right, top-bottom writing. But Asian languages often have up-down, right-left writing styles.
When the value of this attribute changes, the functions of the
text-align attribute and the vertical-align attribute will also change. The corresponding script feature is writingMode. Please see other books I have written.
direction: ltr | rtlParameters:
ltr: left-right
rtl: right-left
The direction attribute sets the writing direction of the text from left to right or from right to left.
The above is the detailed content of The difference between css direction attribute and writing-mode attribute. For more information, please follow other related articles on the PHP Chinese website!