writing-mode
Quick Summary for writing-mode
The writing-mode CSS property sets whether lines of text are laid out horizontally or vertically, as well as the direction in which blocks progress. When set for an entire document, it should be set on the root element (html element for HTML documents).
Code Usage for writing-mode
/* Keyword values */ writing-mode: horizontal-tb; writing-mode: vertical-rl; writing-mode: vertical-lr;  /* Global values */ writing-mode: inherit; writing-mode: initial; writing-mode: revert; writing-mode: unset; 
More Details for writing-mode

writing-mode

The writing-mode CSS property sets whether lines of text are laid out horizontally or vertically, as well as the direction in which blocks progress. When set for an entire document, it should be set on the root element (html element for HTML documents).

This property specifies the block flow direction, which is the direction in which block-level containers are stacked, and the direction in which inline-level content flows within a block container. Thus, it also determines the ordering of block-level content.

Syntax

/* Keyword values */ writing-mode: horizontal-tb; writing-mode: vertical-rl; writing-mode: vertical-lr;  /* Global values */ writing-mode: inherit; writing-mode: initial; writing-mode: revert; writing-mode: unset; 

The writing-mode property is specified as one of the values listed below. The flow direction in horizontal scripts is also affected by the directionality of that script, either left-to-right (ltr, like English and most other languages) or right-to-left (rtl, like Hebrew or Arabic).

Values

horizontal-tb

For ltr scripts, content flows horizontally from left to right. For rtl scripts, content flows horizontally from right to left. The next horizontal line is positioned below the previous line.

vertical-rl

For ltr scripts, content flows vertically from top to bottom, and the next vertical line is positioned to the left of the previous line. For rtl scripts, content flows vertically from bottom to top, and the next vertical line is positioned to the right of the previous line.

vertical-lr

For ltr scripts, content flows vertically from top to bottom, and the next vertical line is positioned to the right of the previous line. For rtl scripts, content flows vertically from bottom to top, and the next vertical line is positioned to the left of the previous line.

sideways-rl

For ltr scripts, content flows vertically from bottom to top. For rtl scripts, content flows vertically from top to bottom. All the glyphs, even those in vertical scripts, are set sideways toward the right.

sideways-lr

For ltr scripts, content flows vertically from top to bottom. For rtl scripts, content flows vertically from bottom to top. All the glyphs, even those in vertical scripts, are set sideways toward the left.

lr

Deprecated except for SVG1 documents. For CSS, use horizontal-tb instead.

lr-tb

Deprecated except for SVG1 documents. For CSS, use horizontal-tb instead.

rl

Deprecated except for SVG1 documents. For CSS, use horizontal-tb instead.

tb

Deprecated except for SVG1 documents. For CSS, use vertical-lr instead.

tb-lr

Deprecated except for SVG1 documents. For CSS, use vertical-lr instead.

tb-rl

Deprecated except for SVG1 documents. For CSS, use vertical-rl instead.

Formal definition

Initial valuehorizontal-tb
Applies toall elements except table row groups, table column groups, table rows, and table columns
Inheritedyes
Computed valueas specified
Animation typediscrete

Formal syntax

horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr

Examples

Using multiple writing modes

This example demonstrates all of the writing modes, showing each with text in various languages.

HTML

The HTML is a <table> with each writing mode in a row with a column showing text in various scripts using that writing mode.

<table>   <tr>     <th>Value</th>     <th>Vertical script</th>     <th>Horizontal (LTR) script</th>     <th>Horizontal (RTL) script</th>     <th>Mixed script</th>   </tr>   <tr>     <td>horizontal-tb</td>     <td class="example Text1"><span>我家没有电脑。</span></td>     <td class="example Text1"><span>Example text</span></td>     <td class="example Text1"><span>מלל ארוך לדוגמא</span></td>     <td class="example Text1"><span>1994年に至っては</span></td>   </tr>   <tr>     <td>vertical-lr</td>     <td class="example Text2"><span>我家没有电脑。</span></td>     <td class="example Text2"><span>Example text</span></td>     <td class="example Text2"><span>מלל ארוך לדוגמא</span></td>     <td class="example Text2"><span>1994年に至っては</span></td>   </tr>   <tr>     <td>vertical-rl</td>     <td class="example Text3"><span>我家没有电脑。</span></td>     <td class="example Text3"><span>Example text</span></td>     <td class="example Text3"><span>מלל ארוך לדוגמא</span></td>     <td class="example Text3"><span>1994年に至っては</span></td>   </tr>   <tr>     <td>sideways-lr</td>     <td class="example Text4"><span>我家没有电脑。</span></td>     <td class="example Text4"><span>Example text</span></td>     <td class="example Text4"><span>מלל ארוך לדוגמא</span></td>     <td class="example Text4"><span>1994年に至っては</span></td>   </tr>   <tr>     <td>sideways-rl</td>     <td class="example Text5"><span>我家没有电脑。</span></td>     <td class="example Text5"><span>Example text</span></td>     <td class="example Text5"><span>מלל ארוך לדוגמא</span></td>     <td class="example Text5"><span>1994年に至っては</span></td>   </tr> </table> 
CSS

The CSS that adjusts the directionality of the content looks like this:

.example.Text1 span, .example.Text1 {   writing-mode: horizontal-tb;   -webkit-writing-mode: horizontal-tb;   -ms-writing-mode: horizontal-tb; }  .example.Text2 span, .example.Text2 {   writing-mode: vertical-lr;   -webkit-writing-mode: vertical-lr;   -ms-writing-mode: vertical-lr; }  .example.Text3 span, .example.Text3 {   writing-mode: vertical-rl;   -webkit-writing-mode: vertical-rl;   -ms-writing-mode: vertical-rl; }  .example.Text4 span, .example.Text4 {   writing-mode: sideways-lr;   -webkit-writing-mode: sideways-lr;   -ms-writing-mode: sideways-lr; }  .example.Text5 span, .example.Text5 {   writing-mode: sideways-rl;   -webkit-writing-mode: sideways-rl;   -ms-writing-mode: sideways-rl; } 
Result

This image shows what the output should look like, in case your browser's support for writing-mode is incomplete:

Specifications

Specification
CSS Writing Modes Level 4 # block-flow

See also

SVG writing-mode attribute direction unicode-bidi text-orientation text-combine-upright CSS Logical properties Styling vertical text (Chinese, Japanese, Korean and Mongolian) Extensive browsers support test results: https://w3c.github.io/i18n-tests/results/writing-mode-vertical Select your preferred language English (US)EspañolFrançais日本語Português (do Brasil)Русский中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote

"Olivia, my eldest daughter, caught measles when she was seven years old. As the illness took its usual course I can remember reading to her often in bed and not feeling particularly alarmed about it. Then one morning, when she was well on the road to recovery, I was sitting on her bed showing her how to fashion little animals out of coloured pipe-cleaners, and when it came to her turn to make one herself, I noticed that her fingers and her mind were not working together and she couldn’t do anything. 'Are you feeling all right?' I asked her. 'I feel all sleepy,' she said. In an hour, she was unconscious. In twelve hours she was dead. The measles had turned into a terrible thing called measles encephalitis and there was nothing the doctors could do to save her. That was...in 1962, but even now, if a child with measles happens to develop the same deadly reaction from measles as Olivia did, there would still be nothing the doctors could do to help her. On the other hand, there is today something that parents can do to make sure that this sort of tragedy does not happen to a child of theirs. They can insist that their child is immunised against measles. ...I dedicated two of my books to Olivia, the first was ‘James and the Giant Peach’. That was when she was still alive. The second was ‘The BFG’, dedicated to her memory after she had died from measles. You will see her name at the beginning of each of these books. And I know how happy she would be if only she could know that her death had helped to save a good deal of illness and death among other children."

I just checked google books for BFG, and the dedication is there. 

https://www.google.com.au/books/edition/_/quybcXrFhCIC?hl=en&gbpv=1 


Roald Dahl, 1986
Random CSS Property

:nth-last-child()

The :nth-last-child() CSS pseudo-class matches elements based on their position among a group of siblings, counting from the end.
:nth-last-child css reference