CSS Tinted Elevation Scale
An elevation scale whose shadows are tinted with your brand color, so they look clean on colored pages.
<div class="tinted-elevation tinted-elevation-1"></div>
<div class="tinted-elevation tinted-elevation-2"></div>
<div class="tinted-elevation tinted-elevation-3"></div>
.tinted-elevation {
--tint: #4338ca;
width: 64px;
height: 64px;
border-radius: 16px;
background: #ffffff;
}
.tinted-elevation-1 {
box-shadow:
0 1px 2px color-mix(in srgb, var(--tint) 20%, transparent),
0 2px 6px -1px color-mix(in srgb, var(--tint) 16%, transparent);
}
.tinted-elevation-2 {
box-shadow:
0 2px 4px color-mix(in srgb, var(--tint) 16%, transparent),
0 10px 20px -6px color-mix(in srgb, var(--tint) 28%, transparent);
}
.tinted-elevation-3 {
box-shadow:
0 4px 8px color-mix(in srgb, var(--tint) 14%, transparent),
0 24px 44px -12px color-mix(in srgb, var(--tint) 40%, transparent);
}
About this CSS Tinted Elevation Scale
This CSS Tinted Elevation Scale is 25 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses box shadows and custom properties. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
Change these custom properties to restyle the tinted elevation scale without touching the rest of the CSS:
| Property | Default |
|---|---|
--tint | #4338ca |
How to use this tinted elevation scale
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.tinted-elevationclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.