Essential CSS
JavaScript Roadmap
Learn JavaScript
Mastering Web Typography
Practical Astro
Understanding Async JS
Unorthodox Tailwind
API Masterclass
Build and Deploy
The Beginner Freelancer
Real World Node
Profile Billing Logout
Unorthodox Tailwind
Lesson Plan
  1. Introduction
    1. Introduction
    2. What Tailwind brings to the table
    3. Tailwind: The Good and The Bad
    4. The First and Most Important Step
    5. Simple Unorthodox System
    6. The System I Use
  2. Tailwind Fundamentals
    1. Introduction
    2. Installing Tailwind
    3. Using Tailwind utilities
    4. Understanding Tailwind’s utility system
    5. Understanding Tailwind values
    6. Understanding Tailwind variants
  3. Unorthodox Fundamentals
    1. Introduction
    2. Making Simple Tailwind Utilities
    3. Components vs Utilities
    4. Specificity, Cascade, and CSS Layers
    5. Debugging Tailwind Styles
    6. Composable Utility System
    7. Create lots of components
  4. Layouts System
    1. Tailwind is great for layouts
    2. Four Types of Layouts
    3. Building Shell Layouts
    4. Building Macro Layouts
    5. Better Responsive Variants
    6. A collection of maximum widths
    7. A note on grid wrappers
    8. Working with sections
    9. Building Micro Layouts
    10. Positioning Layouts
  5. Typography System
    1. Introduction
    2. A system for using multiple typefaces
    3. Tailwind's font-size system
    4. Finding your font-size system
    5. My font-size system
    6. A simple responsive typography system
    7. The main body
    8. Vertical rhythm
  6. Theming System
    1. Introduction
    2. Tailwind's colour system
    3. The pigment system
    4. Tailwind's gradient system
    5. A friendlier gradient system
    6. Handling SVG fill and stroke
    7. Improving Tailwind's colour palette
    8. A simple way to theme
  7. Useful Tools
    1. Introduction
    2. Making functional utilities
    3. Custom variants
    4. Scaffolding tools
    5. Extending Tailwind
  8. Effects System
    1. Introduction
    2. Vertical text
    3. Strikethrough text
    4. Text stroke
    5. Highlighting text
    6. Nicer shadows
    7. Transitioning shadows
    8. Drop shadows
    9. Dark mode tricks
    10. Gradient borders
    11. More effects to explore
  9. Putting Everything Together
    1. The Unorthodox Tailwind process
    2. The 4 systems combined
    3. Create components liberally
    4. Advanced tips
    5. My CSS Structure
    6. A Cheatsheet
    7. Consolidating your thoughts
    8. Parting words

Vertical text

2m:56s

Let’s begin by creating simple effects because they are easier to understand and grasp, then we’ll make our way to more complex ones.

We’ll begin with a text rotation effect.

One of the simplest ways to rotate anything is with the rotate utility.

<div class="-rotate-3">Counterclockwise rotation</div>
<div class="rotate-3">Clockwise rotation</div>

Counterclockwise

Clockwise

This is fine, but we run into a problem if we want to rotate text to a point where it is vertical on the left or on the right.

A transform (which rotate uses) allows the rotation to happen, but it keeps the element in the document flow as if it was still horizontal.

Counterclockwise

Clockwise

The best way to overcome this kind of issue is to use writing mode.

Using Writing Mode

Normal text has the writing mode that is horizontal-tb — horizontal first, from top to bottom.

.normal-writing-mode {
writing-mode: horizontal-tb;
}

If we want text to be displayed vertically, we can use the vertical writing mode. There are two modes in this case: vertical-lr or vertical-rl.

  • vertical-lr: Vertical direction, from left to right.
  • vertical-rl: Vertical direction, from right to left.

For languages like Chinese, it doesn’t matter whether we use vertical-lr or vertical-rl because both are readable. But it doesn’t work this way for English — the text is only understandable in vertical-rl mode.

vertical-lr

很久很久以前,山上有座庙,庙里有一个和尚。

A long time ago, there was a temple on a mountain. In the temple, there is a monk.

vertical-rl

A long time ago, there was a temple on a mountain. In the temple, there is a monk.

很久很久以前,山上有座庙,庙里有一个和尚。

You gotta rotate your head for this one!

To create text that flows from the bottom to the top (and is easily readable), we can rotate the text after using vertical-rl.

This allows the text to flow accordingly, and we do not have to arbitrarily create a height to contain that text.

<div class="writing-rotateleft">Counterclockwise</div>
<div class="writing-rotateright">Clockwise</div>
@utility writing-rotateleft {
transform: rotate(180deg);
writing-mode: vertical-rl;
}
@utility writing-rotateright {
writing-mode: vertical-rl;
}

Counterclockwise

Clockwise

I used this technique to create the left header for Splendid Labz’s docs page.

Splendid Labz docs page showing vertical text used as the left header

I’ll be honest with you, you won’t use this utility much, but it’s nice to have around when you need it!