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 4 systems combined

2m:15s

I categorized most styles necessary for a website into 4 simple categories:

  • Layouts
  • Typography
  • Theming
  • Effects

Here’s how I generally write styles for each system.

Layouts

At this point, I build most of my layouts with Splendid Layouts. It contains all of the utilities I need to make 95% of the sites I build.

I almost always write these directly in the HTML because each layout depends on the section themselves. There’s not much use trying to consolidate things together.

<section class="section">
<div class="wrap vertical">
<div class="vertical">
<h2 class="text-center max-w-[12em]">Title</h2>
<p class="text-center max-w-[12em]">Subtitle</p>
</div>
<div class="prose max-w-narrow mx-auto">
<!-- Text goes here -->
</div>
<div class="grid-simple [--cols:2] max-w-standard mx-auto">
<!-- Grid items go here -->
</div>
</div>
</section>

However, if I need to reuse a layout consistently — like a global content-sidebar layout, I might create a class for it.

.grid-content-sidebar {
@apply grid-simple;
@media screen (width >= 800px) {
--cols: 3;
.content {
--span: 2;
}
}
}

Typography

Typography is always defined in a type.css file. These typography utilities are used directly in the HTML according to the required element.

I rarely use typography utilities in CSS.

<div class="wrap vertical">
<div class="vertical">
<h2 class="h2 ...">Title</h2>
<p class="h2-subhead ...">Subtitle</p>
</div>
<div class="prose ...">
<!-- Text goes here -->
</div>
</div>

The only time I use typography utilities in CSS is when writing them in CSS saves more keystrokes than writing them directly in HTML. This is rare, because most of these situations can be alleviated with framework component files.

Colour and Theming

For colours, I generally save them in two files:

  • colours.css
  • pigments.css

These are named so I know what they contain exactly — and I can reach into them to adjust values easily.

For usage: I tend to use the colour directly with Tailwind when the requirements are simple. Then I switch over to pigments for interactive elements.

<h2 class="text-yellow-500">...</h2>
<button class="button pigment-yellow-heavy">...</button>

Certain interactive elements are styled in the CSS because determining a pigment for them is too much work. For these, I use the pigment utility and adjust the values within them.

.tabs {
@apply pigment;
--selected-color: var(--colour-yellow-500);
}

Effects

I tend to place effects in the HTML whenever I can — so they become obvious when I look at the HTML.

<h2 class="text-stroke spl-stroke-yellow-500">...</h2>

I have a higher tendency to put complex effects — like gradient borders — into their own CSS file, because they tend to be used together with the components they’re created for.

.card {
@apply bezel-frosted outer-gradient;
--gradient-shape: circle;
--gradient-position: 0% 50%;
--gradient: blue 50%, pink 75%, red;
}