惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
G
Google Developers Blog
博客园 - 叶小钗
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
博客园_首页
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 三生石上(FineUI控件)
Help Net Security
Help Net Security
Cloudbric
Cloudbric
AI
AI
N
News | PayPal Newsroom
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
Forbes - Security
Forbes - Security
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
SecWiki News
SecWiki News
H
Heimdal Security Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
V
V2EX
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
S
Security Affairs
L
LangChain Blog
The Hacker News
The Hacker News
F
Full Disclosure
aimingoo的专栏
aimingoo的专栏
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
Webroot Blog
Webroot Blog
A
About on SuperTechFans
H
Hacker News: Front Page
Cyberwarzone
Cyberwarzone
WordPress大学
WordPress大学
L
LINUX DO - 热门话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Attack and Defense Labs
Attack and Defense Labs
M
MIT News - Artificial intelligence

CSS-Tricks

pointer-events | CSS-Tricks What’s !important #15: Boundary-aware CSS, Time-based CSS, Full-bleed CSS, and More | CSS-Tricks Get Ready For the Powerful CSS border-shape Property! | CSS-Tricks What’s !important #14: Gap Decorations, random(), <select> field sizing, and More | CSS-Tricks The Shifting Line Between CSS States and JavaScript Events | CSS-Tricks translateZ() | CSS-Tricks translateY() | CSS-Tricks translateX() | CSS-Tricks translate() | CSS-Tricks Using Scroll-Driven Animations for Opposing Scroll Directions | CSS-Tricks A First Look at Scroll-Triggered Animations | CSS-Tricks The Siren Song of  ariaNotify() | CSS-Tricks Prop For That | CSS-Tricks What’s !important #13: @function, alpha(), CSS Wordle, and More | CSS-Tricks There’s no need to include ‘navigation’ in your navigation labels | CSS-Tricks Why Isn't My 3D View Transition Working? | CSS-Tricks Creating Memorable Web Experiences: A Modern CSS Toolkit | CSS-Tricks Scroll-Driven, Scroll-Triggered, Scroll States, and View Transitions | CSS-Tricks Another Stab at the Perfect CSS Pie Chart... Sans JavaScript! | CSS-Tricks offset-path | CSS-Tricks @custom-media | CSS-Tricks @function | CSS-Tricks ::search-text | CSS-Tricks Astro Markdown Component Utility for Any Framework | CSS-Tricks What’s !important #12: Safari Testing, ::checkmark, HTML Anchor Positioning, and More | CSS-Tricks Revealing Text With CSS letter-spacing | CSS-Tricks Technical Writing in the AI Age | CSS-Tricks Cross-Document View Transitions: Scaling Across Hundreds of Elements | CSS-Tricks The State of CSS Centering in 2026 | CSS-Tricks Stack Overflow: When We Stop Asking | CSS-Tricks Cross-Document View Transitions: The Gotchas Nobody Mentions | CSS-Tricks What’s !important #11: 3D Voxel Scenes, Flying Focus, CSS Syntaxes, and More | CSS-Tricks Computing and Displaying Discounted Prices in CSS | CSS-Tricks rotateX() | CSS-Tricks rotateY() | CSS-Tricks rotateZ() | CSS-Tricks rotate() | CSS-Tricks Soon We Can Finally Banish JavaScript to the ShadowRealm | CSS-Tricks Using CSS corner-shape For Folded Corners | CSS-Tricks contrast() | CSS-Tricks contrast-color() | CSS-Tricks hypot() | CSS-Tricks saturate() | CSS-Tricks justify-self | CSS-Tricks
writing-mode | CSS-Tricks
Mojtaba Seyedi · 2026-07-21 · via CSS-Tricks

The writing-mode CSS property sets whether lines of text are laid out horizontally or vertically, and the direction in which blocks and lines progress.

.element {
  writing-mode: vertical-rl;
}

This is most useful in languages such as Chinese, Japanese or Korean where the text is often set vertically. In the English language, it’s more likely that you’ll want to use this property for aesthetics reasons, such as aligning a heading in a block of text like this:

Syntax

writing-mode: horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr;
  • Initial: horizontal-tb
  • Applies to: all elements except table row groups, table column groups, table rows, table columns, ruby base containers, ruby annotation containers
  • Inherited: yes
  • Computed value: as specified
  • Animation type: not animatable

Values

writing-mode: horizontal-tb;
writing-mode: vertical-rl;
writing-mode: vertical-lr;
writing-mode: sideways-rl;
writing-mode: sideways-lr;

/* Global values */
writing-mode: inherit;
writing-mode: initial;
writing-mode: revert;
writing-mode: revert-layer;
writing-mode: unset;

Each value combines two parts. The first describes whether text is laid out in horizontal or vertical lines, while the second describes the direction in which those lines and block-level content progress. tb means top-to-bottom, rl means right-to-left, and lr means left-to-right.

  • horizontal-tb: This is the default value. Text is laid out in horizontal lines, with lines and blocks progressing from top to bottom.
  • vertical-rl: Text is laid out in vertical lines, with lines and blocks progressing from right to left. Each new line is placed to the left of the previous one.
  • vertical-lr: Text is laid out in vertical lines, with lines and blocks progressing from left to right. Each new line is placed to the right of the previous one.
  • sideways-rl: Text is laid out in vertical lines that progress from right to left, but uses the typographic conventions of horizontal writing. As a result, the glyphs are rotated sideways, facing toward the right.
  • sideways-lr: Text is laid out in vertical lines that progress from left to right, but uses the typographic conventions of horizontal writing. As a result, the glyphs are rotated sideways, facing toward the left.

Writing modes and CSS layout

The writing-mode property doesn’t just change the orientation of text. More fundamentally, it establishes the block and inline directions that CSS uses to lay out content.

The inline axis follows the direction in which content flows within a line, while the block axis follows the direction in which blocks and lines stack. These axes can be horizontal or vertical depending on the writing mode.

In the default horizontal-tb writing mode, the inline axis runs horizontally and the block axis runs vertically. In a vertical writing mode such as vertical-rl, the inline axis runs vertically and the block axis runs horizontally.

Modern CSS layout is built around these logical axes. Flexbox, Grid, alignment, and logical properties describe relationships in terms of block, inline, start, and end, rather than being permanently tied to physical directions such as top, right, bottom, and left.

This is why logical properties such as inline-size and block-size are useful. Rather than referring to a fixed physical dimension like width and height, they describe the size of an element along its inline or block axis:

.element {
  inline-size: 20rem;
  block-size: 10rem;
}

In a horizontal writing mode, inline-size corresponds to the horizontal dimension and block-size to the vertical dimension. In a vertical writing mode, those relationships are switched.

The same principle applies to flow-relative properties such as margin-inline-start and padding-block-end, which refer to logical directions rather than fixed physical sides of the screen like left and bottom.

In Flexbox, a container with flex-direction set to row lays out items along the inline axis, while column lays them out along the block axis. As a result, a row can be horizontal or vertical depending on the writing mode.

Grid also respects the writing mode when placing and sizing items. Its rows and columns are not permanently tied to the physical horizontal and vertical directions.

Alignment properties such as align-items and justify-items , among others, follow the same principle.

Understanding this model is useful even if you never create a vertical layout. Once you start thinking in terms of block and inline axes, many modern CSS layout features become easier to understand, plus your layouts become less dependent on a particular writing direction or physical screen orientation.

Demo

Use the dropdowns to try different languages, writing-mode values, and direction. Watch how the text, the container, and the inline and block axis indicators change.

The language selector sets the typical values for each script, but you can override them to experiment. Notice that writing-mode changes more than the orientation of the text. It also changes how the entire container and its contents flow.

Browser Support

The writing-mode property is defined in the CSS Writing Modes Level 4 specification and is widely available across modern browsers.