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

The main body

2m:14s

When it comes to typography, we always have to talk about the main body of the text, because there’s a lot going on in here.

  • Headers
  • Ordered and unordered lists
  • Paragraphs
  • Images
  • Block quotes
  • Code
  • And other styles

Tailwind’s prose utility

Tailwind has a prose utility that claims to help you create beautiful typography… but whether you believe the claim is up to you.

It is not built into Tailwind, so you have to install a plugin if you want it.

<!-- Basic usage according to the plugin's docs -->
<article class="prose lg:prose-xl">
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as a warm, cheesy loaf for
Halloween.
</p>
<p>
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
<!-- ... -->
</article>

You can have a look at the styles.js file if you want to have an idea about what’s included in this build. (This is built on Tailwind 3).

// Sample of what's in styles.js
let defaultModifiers = {
sm: {
css: [
{
fontSize: rem(14),
lineHeight: round(24 / 14),
p: {
marginTop: em(16, 14),
marginBottom: em(16, 14),
},
'[class~="lead"]': {
fontSize: em(18, 14),
lineHeight: round(28 / 18),
marginTop: em(16, 18),
marginBottom: em(16, 18),
},
},
],
},
}

One quick look at this code tells me that this plugin is going to be very difficult to override.

So I don’t use this plugin, but instead create my own prose utility.

My prose utility

I stole the word prose from Tailwind because I think it is a very apt description of what this does. It’s included in @splendidlabz/styles so you don’t have to install anything else.

It’s a pretty complex utility so I’m not going to include the full code here. But here’s the rough gist of what it does:

  1. It adds margin-top and scroll-margin-block to the headers.
  2. It adds a nice left indentation for ordered and unordered lists.
    1. It works with nested list items
    2. It adds a little bit of margin between li items so they are easily differentiated from each other.
  3. It makes anchor text decoration underline.
  4. It creates a gap of 1lh between blocks.
  5. It adds borders to images and allows figures to be inline-sized.

You can find the full code on Splendid Labz if you’re curious to learn more.