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

Extending Tailwind

1m:49s

Besides font-size and breakpoints, I’ve also extended Tailwind utilities in the following ways to aid my work.

Border

Tailwind uses the following values for border-width by default:

Size Output
border-1 1px
border-2 2px
And so on…

I don’t like this because 1px, 2px and 3px are very easy to write with arbitrary values. We don’t need shorthand for them at all!

So I choose to attach --spacing values for vertical rhythm to border-* instead. This overrides Tailwind defaults and might be a breaking change for some sites!

@utility border-* {
border-width: --spacing(--value(number));
border-width: --value([length]);
}

Border Radius

Tailwind has border radii that go from xs to 4xl. I don’t agree with their scale because it sounds arbitrary and inconsistent.

Size Output Increment
xs 2px —
sm 4px +2px
md 6px +2px
lg 8px +2px
xl 12px +4px
2xl 16px +4px
3xl 24px +8px
4xl 32px +8px

I prefer to treat border-radius like padding and margin where we can simply use the --spacing numbers. That’s because:

  1. It’s tied to something that is consistent.
  2. --spacing is related to the rhythm that we use on our site

So I extended the border radius utility to include spacing numbers.

@utility rounded-* {
border-radius: --spacing(--value(number));
}

I also extended all utilities for the 4 corners and shorthand utilities for the 4 sides.

@utility rounded-t-* {
border-top-left-radius: --spacing(--value(number));
border-top-right-radius: --spacing(--value(number));
}
@utility rounded-b-* {
border-bottom-left-radius: --spacing(--value(number));
border-bottom-right-radius: --spacing(--value(number));
}
@utility rounded-l-* {
border-top-left-radius: --spacing(--value(number));
border-bottom-left-radius: --spacing(--value(number));
}
@utility rounded-r-* {
border-top-right-radius: --spacing(--value(number));
border-bottom-right-radius: --spacing(--value(number));
}
@utility rounded-tl-* {
border-top-left-radius: --spacing(--value(number));
}
@utility rounded-tr-* {
border-top-right-radius: --spacing(--value(number));
}
@utility rounded-bl-* {
border-bottom-left-radius: --spacing(--value(number));
}
@utility rounded-br-* {
border-bottom-right-radius: --spacing(--value(number));
}

Finally, I added a utility that adjusts the --radius property that my border-scaffold uses.

@utility radius-* {
--radius: --spacing(--value(number));
}