Laravel Cloud is here! Zero-config managed infrastructure for Laravel apps. Deploy now.

Scrollbar Styling and Container Size Utilities in Tailwind CSS v4.3.0

Published on by

Scrollbar Styling and Container Size Utilities in Tailwind CSS v4.3.0 image

Tailwind CSS v4.3.0 brings scrollbar styling utilities, container queries gain a way to read the container's own size, and the @variant directive becomes flexible enough to handle stacked and compound variants directly inside CSS.

  • Scrollbar width, color, and gutter utilities
  • New @container-size utility for container query units
  • zoom-* and tab-* utilities
  • @variant accepts stacked and compound variants
  • --default(…) support inside --value(…) and --modifier(…)
Scrollbar color utilities in Tailwind CSS v4.3.0 shown in Tailwind Play
Scrollbar color utilities in Tailwind CSS v4.3.0 shown in Tailwind Play

What's New

Scrollbar Styling Utilities

Tailwind CSS v4.3.0 adds first-party utilities for styling scrollbars. You can control the width and color of scrollbars directly, plus reserve gutter space to prevent layout shift when scrollbars appear.

<div class="scrollbar-thin scrollbar-thumb-slate-500 scrollbar-track-slate-100 overflow-y-auto">
<!-- content -->
</div>
 
<div class="scrollbar-gutter-stable">
<!-- reserves space so layout doesn't jump -->
</div>

PRs: #19981, #20019, #20018

@container-size Utility

Container queries shipped earlier in v4, and this release adds an @container-size utility that exposes the container's size for use inside the container. It pairs naturally with the existing @container utility for layouts that need to respond to their parent rather than the viewport.

PR: #18901

zoom-* and tab-* Utilities

Two more CSS properties get utility coverage in this release. zoom-* maps to the zoom property for scaling content without affecting layout flow, and tab-* controls tab-size for elements where preserved whitespace matters, like <pre> blocks.

PRs: #20020, #20022

Flexible @variant Syntax

The @variant directive now accepts the same stacked and compound variant syntax used in class names. That means you can write CSS that targets hover:focus (both at once) or hover, focus (either) without splitting it into multiple rules.

@variant hover:focus {
.my-component {
outline: 2px solid currentColor;
}
}
 
@variant hover, focus {
.my-component {
background: var(--color-slate-100);
}
}

PR: #19996

--default(…) in Functional Utilities

When defining functional utilities with @utility, you can now reach for --default(…) inside --value(…) and --modifier(…) to provide a fallback when no value is supplied. It makes custom utilities behave more like the built-in ones, which already gracefully handle the no-argument case.

PR: #19989

Canonicalization and Upgrade Fixes

The canonicalizer used by the upgrade tool got a round of fixes that matter if you run tailwindcss upgrade on existing projects. Significant underscore whitespace is preserved in arbitrary values, original units are kept instead of being normalized (so -mt-[20in] becomes mt-[-20in], not mt-[-1920px]), arbitrary :has() variants migrate to the shorthand has-[…] form, and inline style attributes are left alone instead of being rewritten into Tailwind classes.

References

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

SerpApi
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing

The latest

View all →
Laravel's AI SDK adds sub-agents image

Laravel's AI SDK adds sub-agents

Read article
Laravel Introduces First-Party Passkey Authentication Support image

Laravel Introduces First-Party Passkey Authentication Support

Read article
Attach Addresses to Any Eloquent Model with Laravel Addressable image

Attach Addresses to Any Eloquent Model with Laravel Addressable

Read article
Generate Livewire Skeleton Placeholders Automatically with Wirebones image

Generate Livewire Skeleton Placeholders Automatically with Wirebones

Read article
Laravel ClickHouse: A Full-Featured ClickHouse Driver for Laravel image

Laravel ClickHouse: A Full-Featured ClickHouse Driver for Laravel

Read article
Laravel Installer Now Returns JSON When Running Inside an AI Agent image

Laravel Installer Now Returns JSON When Running Inside an AI Agent

Read article