ZL
About Articles Contact
Published on Dec 23, 2023
Filed under:
#css,
#splendidlabz,
#tailwind

Changing CSS Variables with Tailwind

Today I discovered that you can change CSS Variables with Tailwind on the fly.

Here’s the syntax:

<div class="[--span:2] md:[--span:3]">...</div>

This is very powerful — because it gives me the ability to change the number of columns in a custom grid easily with CSS Variables like --span.

And as you may suspect, I’m integrating this methodology with the layouts I’m creating in CSS Layout Patterns.

One of my latest inventions is a Masonry Grid that can span multiple columns — with super little CSS and JavaScript.

Honestly, I’m seeing CSS Layout Patterns as the easiest way to create layouts now. Can’t wait to share more about it in the future.

Previous The main challenge of building an Astro-first component library Next 3 Techniques to learn JavaScript effectively

Join My Newsletter

I share what I’m learning on this newsletter: code, building businesses, and living well.

Sometimes I write about technical deep-dives, product updates, musings on how to live, and sometimes my struggles and how I’m breaking through.

Regardless of the type of content, I do my best to send you an update every week.

If you’re into making things and growing as a person, you’ll probably feel at home here.

“

Zell is one of those rare people who commands tremendous knowledge and experience but remains humble and helpful. They want you to know what they know, not just be impressed by it.

In other words, Zell is a natural teacher. You’re lucky to have him because he feels lucky to be able to help you in your journey.

Heydon Pickering
Heydon Pickering — Web & Accessibility Extraordinaire
The Footer

General

Home About Contact Testimonials Tools I Use

Projects

Magical Dev School Splendid Labz

Socials

Youtube Instagram Tiktok Github Bluesky X

Follow Along

Email RSS
© 2013 - 2025 Zell Liew / All rights reserved / Terms