In CSS, Writing-mode and direction are used to control the direction in which text is displayed, but there are differences between them.
In the Writing-mode parameters have LR-TB (left and right) Tb-rl (up and down), in Western countries the way of writing is usually about-up and down, but in Asian countries, such as Chinese poetry from right to left, the Writing-mode attribute is reflected!
Example:
<div class= "mode" >
. mode{ writing-mode:tb-rl; } p{ font-size:24px; }
Show the effect:
The parameters of the direction are ltr (left to right) and RTL (right to left).
Controls whether text is written in left-to-right or right-to-left direction through direction.
First, Layout-flow: Also controls the flow of text content of the object (but this property can be replaced by the Writing-mode property)
In CSS, Writing-mode and direction are used to set the way the text is presented, with some similarities and essential differences. Let's look at the use of both:
Writing-mode
Grammar:
WRITING-MODE:LR-TB | Tb-rl
Parameters:
LR-TB: Left-right, up-down
TB-RL: Up-down, right-left
Description
Sets or retrieves the intrinsic writing direction of the object's content block. The Western language is certainly the left-right, the upper-lower writing style. But Asian languages often have a top-down, right-to-left way of writing.
When this property value changes, the effect of the Text-align property and the Vertical-align property will also vary.
The corresponding script attribute is writingmode. Please refer to the other bibliography I have written.
Direction
Grammar:
direction:ltr | Rtl
Parameters:
LTR: Left-right
RTL: Right-left
Description
The Direction property sets whether the writing direction of the text is left-to-right or right-hand.
Through the above comparison we can conclude that if only for the presentation of text, such as from left to right or from the left, we tend to use direction, and in order to deal with different writing habits, especially the writing from the top and write vertical, such as the writing of Chinese ancient writing way, We need to use Writing-mode.