Created
April 14, 2026 23:23
-
-
Save karol-majewski/b77ced607c7c68ec7deaff02ffffae42 to your computer and use it in GitHub Desktop.
Parametric noisy backgrounds in Tailwind CSS v4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Fine noise */ | |
| @utility noise-* { | |
| position: relative; | |
| --noise-opacity: calc(--value(integer) * 1%); | |
| &::before { | |
| content: ""; | |
| position: absolute; | |
| inset: 0; | |
| opacity: var(--noise-opacity); | |
| background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.3'/%3E%3C/svg%3E"); | |
| pointer-events: none; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
Applies noise with 5% opacity:
Applies noise with 90% opacity: