135: Lessons Learned Building Tailwind UI
Episode
98 min
Read time
2 min
Topics
Design & UX
AI-Generated Summary
Key Takeaways
- ✓Line Height Math: Tailwind UI uses 14px font with explicit 20px line height (leading-5) instead of relative 1.5 multiplier to ensure even-numbered button heights of 38px, preventing one-pixel misalignment when centering odd-height elements inside even-height containers like navigation bars with 40px avatars.
- ✓Fixed Line Heights Over Relative: Switching from relative line heights (leading-tight, leading-normal) to explicit pixel values (leading-5 for 20px, leading-6 for 24px) solves layout predictability issues. This approach ensures all UI elements use even numbers, making vertical centering mathematically precise across all component combinations and screen sizes.
- ✓CSS Grid for Pricing Cards: Three-row grid with middle card spanning all rows while outer cards span only row two creates automatic vertical centering. Browser calculates equal empty space above and below outer cards, eliminating Flexbox negative margin hacks and making layouts resilient to content changes without media query adjustments.
- ✓Gap Property Replaces Margins: CSS Grid gap property eliminates negative margin techniques for gutters between columns and rows. One-column grids with gap handle vertical spacing better than margin-top patterns. Upcoming Flexbox gap support will enable fluid wrapping layouts where buttons drop below headers without manual breakpoint management or spacing adjustments.
- ✓Alpine JS for HTML-Only Interactivity: Alpine JS attributes (x-data, x-show) document interactive component behavior directly in HTML without separate script blocks, making state management readable as pseudocode. React and Vue developers can translate Alpine syntax instantly, maintaining the HTML-only paradigm while showing exact class toggles and transition specifications for dropdowns and mobile menus.
What It Covers
Adam Wathan shares technical lessons from building Tailwind UI, covering line height calculations for even-numbered button heights, CSS Grid implementation strategies, the gap property for layout spacing, and architectural decisions around HTML-only components with Alpine JS for interactivity patterns.
Key Questions Answered
- •Line Height Math: Tailwind UI uses 14px font with explicit 20px line height (leading-5) instead of relative 1.5 multiplier to ensure even-numbered button heights of 38px, preventing one-pixel misalignment when centering odd-height elements inside even-height containers like navigation bars with 40px avatars.
- •Fixed Line Heights Over Relative: Switching from relative line heights (leading-tight, leading-normal) to explicit pixel values (leading-5 for 20px, leading-6 for 24px) solves layout predictability issues. This approach ensures all UI elements use even numbers, making vertical centering mathematically precise across all component combinations and screen sizes.
- •CSS Grid for Pricing Cards: Three-row grid with middle card spanning all rows while outer cards span only row two creates automatic vertical centering. Browser calculates equal empty space above and below outer cards, eliminating Flexbox negative margin hacks and making layouts resilient to content changes without media query adjustments.
- •Gap Property Replaces Margins: CSS Grid gap property eliminates negative margin techniques for gutters between columns and rows. One-column grids with gap handle vertical spacing better than margin-top patterns. Upcoming Flexbox gap support will enable fluid wrapping layouts where buttons drop below headers without manual breakpoint management or spacing adjustments.
- •Alpine JS for HTML-Only Interactivity: Alpine JS attributes (x-data, x-show) document interactive component behavior directly in HTML without separate script blocks, making state management readable as pseudocode. React and Vue developers can translate Alpine syntax instantly, maintaining the HTML-only paradigm while showing exact class toggles and transition specifications for dropdowns and mobile menus.
Notable Moment
Wathan discovered iOS Safari ignores line-height values below 1.15 on text inputs, reverting to browser defaults instead of clamping to a minimum value. This undocumented behavior forced abandoning line-height: 1 for form elements, requiring the team to find alternative solutions for achieving consistent even-numbered heights across buttons, inputs, and textareas.
You just read a 3-minute summary of a 95-minute episode.
Get Full Stack Radio summarized like this every Monday — plus up to 2 more podcasts, free.
Pick Your Podcasts — FreeKeep Reading
More from Full Stack Radio
153: DHH – Omarchy and Designing Your Own OS on Arch Linux
Aug 21 · 76 min
20VC (20 Minute VC)
20VC: Lessons from Jensen Huang on "Founder Mode" | How to Know if OpenAI or Anthropic Will Kill your Company | How USV Liking Music Made Them $1BN on an Investment | The Five Year Desert to Product Market Fit & a $5.3BN Valuation with Shiv Rao @ Abridge
May 16
More from Full Stack Radio
152: Ben Orenstein - How to Stand Out When Applying for a Job at a Small Company
Jan 28 · 47 min
Modern Wisdom
The Health Crisis Of Office Jobs - Bob King - #1098
May 16
More from Full Stack Radio
We summarize every new episode. Want them in your inbox?
153: DHH – Omarchy and Designing Your Own OS on Arch Linux
152: Ben Orenstein - How to Stand Out When Applying for a Job at a Small Company
151: DHH – Building HEY with Hotwire
150: Secret Screencasting Tips & Behind the Scenes of Tailwind CSS 2.0
149: Choosing a Payment Processor, Radical Icons & W3C Hype
Similar Episodes
Related episodes from other podcasts
20VC (20 Minute VC)
May 16
20VC: Lessons from Jensen Huang on "Founder Mode" | How to Know if OpenAI or Anthropic Will Kill your Company | How USV Liking Music Made Them $1BN on an Investment | The Five Year Desert to Product Market Fit & a $5.3BN Valuation with Shiv Rao @ Abridge
Modern Wisdom
May 16
The Health Crisis Of Office Jobs - Bob King - #1098
Mind Pump: Raw Fitness Truth
May 16
2859: Take a Week Off and Gain 21% More Muscle — Here's the Science
All-In with Chamath, Jason, Sacks & Friedberg
May 15
Trump-Xi Summit, Benioff: "Not My First SaaSpocalypse," OpenAI vs Apple, Multi-Sensory AI, El Niño
So Money with Farnoosh Torabi
May 15
1983: Ask Farnoosh: 529 Advice, College Saving Strategies and Can AI Provide Financial Advice?
Explore Related Topics
This podcast is featured in Best Cybersecurity Podcasts (2026) — ranked and reviewed with AI summaries.
You're clearly into Full Stack Radio.
Every Monday, we deliver AI summaries of the latest episodes from Full Stack Radio and 192+ other podcasts. Free for up to 3 shows.
Start My Monday DigestNo credit card · Unsubscribe anytime