The CSS Writing Modes Level 3 Specification defines the impact a change the document writing mode has on flow layout. In the writing modes introduction, the specification says,
"A writing mode in CSS is determined by the writing-mode
, direction
, and text-orientation
properties. It is defined primarily in terms of its inline base direction and block flow direction."
The specification defines the inline base direction as the direction in which content is ordered on a line. This defines the start and end of the inline direction. The start is where sentences start and the end is where a line of text ends before it would begin to wrap onto a new line.
The block flow direction is the direction in which boxes, for example paragraphs, stack in that writing mode. The CSS writing-mode property controls the block flow direction. If you want to change your page, or part of your page, to vertical-lr
then you can set writing-mode: vertical-lr
on the element and this will change the direction of the blocks and therefore the inline direction as well.
While certain languages will use a particular writing mode or text direction, we can also use these properties for creative effect, such as running a heading vertically.
<div class="box">
<h1>A heading</h1>
<p>
One November night in the year 1782, so the story runs, two brothers sat
over their winter fire in the little French town of Annonay, watching the
grey smoke-wreaths from the hearth curl up the wide chimney. Their names
were Stephen and Joseph Montgolfier, they were papermakers by trade, and
were noted as possessing thoughtful minds and a deep interest in all
scientific knowledge and new discovery.
</p>
</div>
body {
font: 1.2em sans-serif;
}
h1 {
writing-mode: vertical-lr;
float: left;
}