The difference between CSS direction property and Writing-mode property

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.