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

Tailwind's font-size system

1m:59s

Before we dive deeper into creating your own font size system, let’s take a look at what Tailwind provides you with. This gives you a good idea why we are not using Tailwind’s built-in system.

Tailwind’s system

Tailwind’s system uses the text-* utility, and it writes both font-size and line-height properties. The original values are as follows:

Utility Font Size Line Height
text-xs 0.75rem (12px) 1.33333333
text-sm 0.875rem (14px) 1.42857143
text-base 1rem (16px) 1.5
text-lg 1.125rem (18px) 1.55555556
text-xl 1.25rem (20px) 1.4
text-2xl 1.5rem (24px) 1.33333333
text-3xl 1.875rem (30px) 1.2
text-4xl 2.25rem (36px) 1.11111111
text-5xl 3rem (48px) 1
text-6xl 3.75rem (60px) 1
text-7xl 4.5rem (72px) 1
text-8xl 6rem (96px) 1
text-9xl 8rem (128px) 1

The problems with this approach

It doesn’t work with multiple typefaces

You know from the previous lesson that the best line height value depends on the typeface itself. In general:

  • A typeface with a larger x-height requires a larger line-height.
  • And one with a smaller x-height requires a smaller line-height.

The problem with Tailwind’s system is that line-height values are fixed according to the font-size. It does not take into account the typeface that you’re using — which means it is only designed for one typeface.

If you want to have multiple typefaces, or if you want to use a typeface that is not designed for the Tailwind system, you’ve got to change your line-height values anyway. But changing this tightly-coupled system is a pain in the ass… so we will explore a different font-size system in a bit.

You can’t add sizes easily

The second problem is the reliance on t-shirt sizes as keywords.

If you want to create a size between small and medium, you will have a problem, because a size between small and medium generally doesn’t come to mind. This means you have to do a lot of adjustments to it — which, again, is a pain in the ass.

So let’s explore other alternatives that can work better than this one.