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

Building Shell Layouts

4m:57s

Shell layouts are the layouts that create the application’s shell. It’s the outermost layout of the website or application. It’s kind of like the outer wrappings of a house.

This category includes styles for the header, content, sidebar, and footer.

Building Shell Layouts

Through the process of building this layout, I realized that shell layouts are very unintuitive to build — mostly because I have to remember to deal with the height property of the body element and all other gotchas that I typically would not have to wrestle with when I’m building a normal layout.

That’s why I’ve created two different utilities to build almost any shell layout we want.

  1. shell-simple
  2. shell-grid.

Shell Simple

shell-simple creates a simple one-column layout for the shell, which basically means there is a header and content and a footer. You can include other sections as you need.

Shell Simple

One example of this is the single-column page like Astro’s blog.

To build this, all you have to do is add the shell-simple class along with the children elements that you want to include in it. For the Astro blog, it might look like this.

<div class="shell-simple">
<header>...</header>
<main class="content">...</main>
</div>
Astro blog page with header and content regions outlined

These layouts typically have a footer that sticks to the bottom of the page when there is insufficient content to fill out the entire viewport height.

One prime example of this is a 404 page when there is not enough content.

To build this layout, you just have to include the footer element, and shell-simple will take care of it for you automatically.

<div class="shell-simple">
<header>...</header>
<main class="content">...</main>
<footer>...</footer>
</div>
404 page with footer sticking to the bottom of the viewport

You can also use shell-simple to create a layout that contains multiple columns of content. The whole idea here is that the content within is centered together as one column.

The concept here will be much easier to explain with a picture. If we take CSS-Tricks as an example, you can see that the center content, although it contains two columns, they are centered in a bigger one-column grid.

CSS-Tricks article page with a two-column content area centered in a one-column shell

This layout can be easily created by using a macro layout like grid-simple.

<div class="shell-simple">
<header>...</header>
<div class="content">
<div class="grid-simple [--cols:3]">
<main class="[--span:2]">Article goes here</main>
<aside>Sidebar goes here</aside>
</div>
</div>
</div>

Shell Grid

shell-grid is made for more complicated layouts that typically have a left or right sidebar to go along with it.

Shell Grid

Sites that use this layout typically include complex content — like Twitch.

<!-- Example of building Twitch's shell with shell-grid -->
<div class="shell-grid">
<header>...</header>
<div class="left-sidebar">...</div>
<div class="content">...</div>
<div class="right-sidebar">...</div>
</div>
Twitch

The right sidebar of shell-grid is optional, so you can opt to exclude it if you want to, which makes it very flexible for creating a wide variety of layouts.

Shell Grid with removed header and right sidebar

This makes it possible to create most application shells where there is only a left sidebar (like Cloudflare’s and Stripe’s).

<!-- Example of building Application shells -->
<div class="shell-grid">
<div class="left-sidebar">...</div>
<div class="content">...</div>
</div>
Cloudflare
Cloudflare
Stripe
Stripe

The only caveats to note are:

  1. The header is fixed in place, so it looks like a sticky header.
  2. Scrollbars are created on the sidebar and the content sections themselves, respectively, instead of the main body element.

Hybrid Grid Layouts

Many content websites actually do not need the right-sidebar for shell-grid. Instead, they are best created by using a two-column macro layout within the content of shell-grid. This allows you to center the content like Astro’s and Tailwind’s documentation pages.

<div class="shell-grid">
<!-- Header and left sidebar goes above -->
<div class="content">
<div class="grid-simple [--cols:3] max-w-[60rem] mx-auto">
<main class="[--span:2]">Main Content</main>
<aside>Sidebar</aside>
</div>
</div>
</div>
Astro Docs
Astro Docs
Tailwind Docs
Tailwind Docs

Article sites like CSS-Tricks and documentation like Astro’s documentation often have a tiny list of the contents on the page — very much like the table of contents you see on the right of this website.

Sticky sidebar

This is not considered a shell layout, but more of a macro layout with a two-column grid and the use of a sticky utility from positioning layouts. So I’m going to talk more about this in the positioning lesson.

But here’s an example for you to play with right now.

Content goes here.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos

Choosing between Shell Simple and Shell Grid

The answer here is really easy:

  • Choose shell-simple if you have one content block.
  • Choose shell-grid if you need fixed left and right sidebars.

I hope this helps you, and now you no longer have to struggle with building shell layouts by yourself by copy-pasting code from who knows where.