- Services
- Case Studies
- Technologies
- NextJs development
- Flutter development
- NodeJs development
- ReactJs development
- About
- Contact
- Tools
- Blogs
- FAQ
CSS writing-mode Control Text Flow Direction
Available options include horizontal-tb, vertical-rl, vertical-lr, sideways-rl, and sideways-lr.
Formal Syntax
The formal syntax for the writing-mode
property is defined as follows:
Each value specifies a different direction for the layout of text and block-level elements. The syntax indicates that only one of these values must be specified for the writing-mode
property.
Examples
Basic Horizontal Text Flow
In this example, we’ll use the horizontal-tb
value to demonstrate the default horizontal text flow from left to right.
HTML:
Vertical Text Flow from Right to Left
In this example, we’ll use the vertical-rl
value to demonstrate vertical text flow from top to bottom, with the next line positioned to the left of the previous line.
HTML:
Vertical Text Flow from Left to Right
In this example, we’ll use the vertical-lr
value to demonstrate vertical text flow from top to bottom, with the next line positioned to the right of the previous line.
HTML:
Sideways Text Flow from Right to Left
In this example, we’ll use the sideways-rl
value to demonstrate sideways text flow from top to bottom, with the glyphs set sideways toward the right.
HTML:
Sideways Text Flow from Left to Right
In this example, we’ll use the sideways-lr
value to demonstrate sideways text flow from bottom to top, with the glyphs set sideways toward the left.
HTML:
Browser Compatibility
The writing-mode
property is widely supported across modern browsers. Below is a table outlining the compatibility of the writing-mode
property across various browsers:
Browser | Version | Initial Support Date |
---|---|---|
Google Chrome | 48.0 | January 2016 |
Firefox | 41.0 | September 2015 |
Internet Explorer | 12.0 | July 2015 |
Edge | 12.0 | July 2015 |
Opera | 35.0 | February 2016 |
Safari | 10.1 | September 2017 |
Summary
The writing-mode
property is a powerful CSS tool for controlling the direction of text flow, making it especially useful for multilingual websites and creative page layouts. While most modern browsers support the writing-mode
property, it’s important to check compatibility and use appropriate fallbacks for older browsers that may not fully support all values.
For the most up-to-date information on browser compatibility, refer to the MDN Web Docs Browser Compatibility Data.
See Also
To enhance your understanding and usage of the writing-mode
property, you may find the following related CSS properties and resources helpful:
Related CSS Properties
- [
direction
]WebsiteUrl- The
direction
property specifies the text direction/writing direction within a block-level element. This property is often used in conjunction withwriting-mode
to control text flow in different languages.
- The
- [
unicode-bidi
]WebsiteUrl- The
unicode-bidi
property is used to control the text direction for the Unicode Bidirectional Algorithm. It is particularly useful for handling mixed-direction text, such as combining left-to-right and right-to-left scripts.
- The
- [
text-orientation
]WebsiteUrl- The
text-orientation
property specifies the orientation of text within a line box. It is often used to fine-tune the appearance of vertical text.
- The
- [
text-combine-upright
]WebsiteUrl- The
text-combine-upright
property allows multiple characters to be combined into the space of a single character in vertical text layouts, particularly useful for East Asian typography.
- The
- [CSS Logical Properties]WebsiteUrl
- CSS logical properties provide a way to write CSS that adapts to the writing mode. They include properties like
block-size
,inline-size
, andmargin-inline-start
, which adjust based on the writing mode and direction of the text.
- CSS logical properties provide a way to write CSS that adapts to the writing mode. They include properties like
Additional Resources
- [Styling vertical text (Chinese, Japanese, Korean and Mongolian)]WebsiteUrl
- This article on W3.org provides a comprehensive guide to styling vertical text for languages that traditionally use vertical writing systems, such as Chinese, Japanese, Korean, and Mongolian.
- [CSS writing modes]WebsiteUrl
- The CSS writing modes module defines the CSS writing modes, which control the direction of text flow and block layout. This module includes detailed specifications and examples for using the
writing-mode
property.
- The CSS writing modes module defines the CSS writing modes, which control the direction of text flow and block layout. This module includes detailed specifications and examples for using the
- [Creating vertical form controls]WebsiteUrl
- This guide explains how to create vertical form controls using CSS writing modes, ensuring that form elements align correctly with vertical text.
- MDN Web Docs
- The MDN Web Docs provide extensive documentation on CSS properties, including the
writing-mode
property, with examples, browser compatibility information, and detailed explanations.
- The MDN Web Docs provide extensive documentation on CSS properties, including the
Tutorials and Guides
- [CSS Tricks: Understanding CSS Writing Modes]WebsiteUrl
- This tutorial on CSS Tricks offers an in-depth look at CSS writing modes, with practical examples and tips for implementation.
- [W3Schools CSS writing-mode Property]WebsiteUrl
- W3Schools provides a concise reference and examples for the
writing-mode
property, suitable for beginners and intermediate users.
- W3Schools provides a concise reference and examples for the
By exploring these related properties and resources, you can gain a deeper understanding of how to effectively use the writing-mode
property to create well-designed and accessible web pages.
Talk with CEO
We'll be right here with you every step of the way.
We'll be here, prepared to commence this promising collaboration.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.