Test your skills: Writing modes and logical properties

The aim of this skill test is to assess whether you understand how to handle different text directions using writing modes and logical properties in CSS.

Note: You can try solutions in the interactive editors on this page or in an online editor such as CodePen, JSFiddle, or Glitch.

If you get stuck, you can reach out to us in one of our communication channels.

Task 1

In this task, the box is displayed with a horizontal writing mode. Can you add a line of CSS to change it so it uses a vertical writing mode with right to left text?

Your final result should look like the image below:

A box with a vertical writing mode

Try updating the live code below to recreate the finished example:

Download the starting point for this task to work in your own editor or in an online editor.

Task 2

In this task, we want you to use logical properties to replace width and height in order to maintain the aspect ratio of the box as it is turned vertically.

Your final result should look like the image below:

Two boxes one horizontal the other vertical

Try updating the live code below to recreate the finished example:

Download the starting point for this task to work in your own editor or in an online editor.

Task 3

In this task, we want you to use logical versions of the margin, border, and padding properties so that the edges of the box relate to the text rather than following top, left, bottom and right.

Your final result should look like the image below:

Two boxes one horizontal one vertical with different margin, border and padding

Try updating the live code below to recreate the finished example:

Download the starting point for this task to work in your own editor or in an online editor.