28 CSS Input Fields04 / 28

Pure CSSMIT licensed

Glass Frosted

Frosted-glass input on a soft gradient. Translucent surface with `backdrop-filter` blur and an inner highlight — an elegant fit for hero sections.

Published

Live Demo
Try it

The code

<div class="if-04">
  <div class="if-04-bg" aria-hidden="true"></div>
  <label class="if-04-field">
    <span>Search</span>
    <input type="search" name="q" placeholder="Search anything…" />
  </label>
</div>
.if-04 {
  position: relative;
  width: 100%;
  max-width: 280px;
  border-radius: 14px;
  padding: 14px;
  isolation: isolate;
  overflow: hidden;
}

.if-04-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(40% 60% at 30% 30%, #f59e0b 0%, transparent 60%), radial-gradient(50% 60% at 80% 70%, #7c3aed 0%, transparent 60%), #0a0a14;
  filter: blur(24px);
  transform: scale(1.2);
}

.if-04-field {
  display: grid;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.if-04-field input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: border-color 0.2s, background 0.2s;
}

.if-04-field input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.if-04-field input:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.16);
}
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
Here's a working CSS Input Field from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Glass Frosted
Source: https://codefronts.com/components/css-input-fields/glass-frosted/

Frosted-glass input on a soft gradient. Translucent surface with `backdrop-filter` blur and an inner highlight — an elegant fit for hero sections.
## HTML
```html
<div class="if-04">
  <div class="if-04-bg" aria-hidden="true"></div>
  <label class="if-04-field">
    <span>Search</span>
    <input type="search" name="q" placeholder="Search anything…" />
  </label>
</div>
```
## CSS
```css
.if-04 {
  position: relative;
  width: 100%;
  max-width: 280px;
  border-radius: 14px;
  padding: 14px;
  isolation: isolate;
  overflow: hidden;
}

.if-04-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(40% 60% at 30% 30%, #f59e0b 0%, transparent 60%), radial-gradient(50% 60% at 80% 70%, #7c3aed 0%, transparent 60%), #0a0a14;
  filter: blur(24px);
  transform: scale(1.2);
}

.if-04-field {
  display: grid;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.if-04-field input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: border-color 0.2s, background 0.2s;
}

.if-04-field input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.if-04-field input:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.16);
}
```

How this works

A frosted-glass input floating over a soft radial-gradient backdrop. The gradient lives on a dedicated .if-04-bg element behind the field, blurred with a 24px filter and scaled up 1.2x so the blur's soft edges never reveal the container's box.

The input itself uses backdrop-filter: blur(20px) saturate(160%) (with the -webkit- prefix for Safari) to sample and blur whatever sits behind it, plus a translucent white fill and an inset top highlight that mimics a glass bevel. Critically, the outer wrapper carries isolation: isolate, which creates a new stacking context so z-index: -1 on the backdrop layer stays trapped inside the component instead of leaking behind the page.

Make it yours

  • Swap the two radial-gradient colour stops (#f59e0b and #7c3aed) for any brand pair — high-saturation colours produce the strongest frost effect.
  • Tune the frost by adjusting blur(20px) and saturate(160%); higher saturation compensates for the desaturation that heavy blur naturally causes.
  • Deepen the glass fill by raising rgba(255, 255, 255, 0.1) to 0.16; keep the focus fill proportionally higher so the state change stays visible.
  • Round the corners uniformly by matching border-radius: 14px on the wrapper with 10px on the input, or set both equal for a chunkier look.

Gotchas — read before shipping

  • backdrop-filter only samples pixels rendered behind it — remove the .if-04-bg layer or forget isolation: isolate on the wrapper and the frost samples the page body instead.
  • Firefox shipped backdrop-filter without a prefix in 103; older Firefox versions render a plain translucent fill with no blur, which still looks acceptable.
  • Nested backdrop-filter inside a parent with overflow: hidden plus border-radius can trigger flicker on Safari during scroll — test on iOS before shipping.

Browser support

ChromeSafariFirefoxEdge
76+14+103+76+

backdrop-filter needs the -webkit- prefix for Safari; older Firefox falls back to a flat translucent fill without breaking layout.

Search CodeFronts

Loading…