20 CSS Neon Text Effects13 / 20
Pure-CSS Neon Text (No JavaScript)
The canonical build-it-from-scratch reference: a clean, dependency-free neon headline that layers text-shadow from a tight white core out to a wide coloured bloom — the exact 'no libraries' answer performance-minded devs want.
Published
The code
<div class="cnt-13"> <h2 class="cnt-13__h">no libraries<br><em>just css</em></h2> </div>
<div class="cnt-13">
<h2 class="cnt-13__h">no libraries<br><em>just css</em></h2>
</div>.cnt-13,
.cnt-13 *,
.cnt-13 *::before,
.cnt-13 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.cnt-13 ::selection {
background: oklch(0.82 0.15 320);
color: #12041a;
}
.cnt-13 {
--accent: oklch(0.82 0.17 320);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 60px 20px;
background: #050505;
}
.cnt-13__h {
font-size: clamp(42px,11vw,104px);
font-weight: 800;
line-height: .98;
text-align: center;
letter-spacing: .01em;
color: #fff;
text-shadow: 0 0 2px #fff, 0 0 10px var(--accent), 0 0 22px var(--accent), 0 0 44px color-mix(in oklch,var(--accent) 70%,transparent), 0 0 90px color-mix(in oklch,var(--accent) 40%,transparent);
}
.cnt-13__h em {
font-style: italic;
color: #ffe9fb;
}
@media (prefers-reduced-motion: reduce) {
}.cnt-13,
.cnt-13 *,
.cnt-13 *::before,
.cnt-13 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.cnt-13 ::selection {
background: oklch(0.82 0.15 320);
color: #12041a;
}
.cnt-13 {
--accent: oklch(0.82 0.17 320);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 60px 20px;
background: #050505;
}
.cnt-13__h {
font-size: clamp(42px,11vw,104px);
font-weight: 800;
line-height: .98;
text-align: center;
letter-spacing: .01em;
color: #fff;
text-shadow: 0 0 2px #fff, 0 0 10px var(--accent), 0 0 22px var(--accent), 0 0 44px color-mix(in oklch,var(--accent) 70%,transparent), 0 0 90px color-mix(in oklch,var(--accent) 40%,transparent);
}
.cnt-13__h em {
font-style: italic;
color: #ffe9fb;
}
@media (prefers-reduced-motion: reduce) {
}/* No JavaScript — a single five-layer text-shadow, tight core to wide bloom. */
/* No JavaScript — a single five-layer text-shadow, tight core to wide bloom. */Here's a working CSS Neon Text Effect 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: Pure-CSS Neon Text (No JavaScript)
Source: https://codefronts.com/motion/css-neon-text-effect/pure-css-neon-text-no-javascript/
The canonical build-it-from-scratch reference: a clean, dependency-free neon headline that layers text-shadow from a tight white core out to a wide coloured bloom — the exact 'no libraries' answer performance-minded devs want.
## HTML
```html
<div class="cnt-13">
<h2 class="cnt-13__h">no libraries<br><em>just css</em></h2>
</div>
```
## CSS
```css
.cnt-13,
.cnt-13 *,
.cnt-13 *::before,
.cnt-13 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.cnt-13 ::selection {
background: oklch(0.82 0.15 320);
color: #12041a;
}
.cnt-13 {
--accent: oklch(0.82 0.17 320);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 60px 20px;
background: #050505;
}
.cnt-13__h {
font-size: clamp(42px,11vw,104px);
font-weight: 800;
line-height: .98;
text-align: center;
letter-spacing: .01em;
color: #fff;
text-shadow: 0 0 2px #fff, 0 0 10px var(--accent), 0 0 22px var(--accent), 0 0 44px color-mix(in oklch,var(--accent) 70%,transparent), 0 0 90px color-mix(in oklch,var(--accent) 40%,transparent);
}
.cnt-13__h em {
font-style: italic;
color: #ffe9fb;
}
@media (prefers-reduced-motion: reduce) {
}
```
## JavaScript
```js
/* No JavaScript — a single five-layer text-shadow, tight core to wide bloom. */
```Here's a working CSS Neon Text Effect 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: Pure-CSS Neon Text (No JavaScript)
Source: https://codefronts.com/motion/css-neon-text-effect/pure-css-neon-text-no-javascript/
The canonical build-it-from-scratch reference: a clean, dependency-free neon headline that layers text-shadow from a tight white core out to a wide coloured bloom — the exact 'no libraries' answer performance-minded devs want.
## HTML
```html
<div class="cnt-13">
<h2 class="cnt-13__h">no libraries<br><em>just css</em></h2>
</div>
```
## CSS
```css
.cnt-13,
.cnt-13 *,
.cnt-13 *::before,
.cnt-13 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.cnt-13 ::selection {
background: oklch(0.82 0.15 320);
color: #12041a;
}
.cnt-13 {
--accent: oklch(0.82 0.17 320);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 60px 20px;
background: #050505;
}
.cnt-13__h {
font-size: clamp(42px,11vw,104px);
font-weight: 800;
line-height: .98;
text-align: center;
letter-spacing: .01em;
color: #fff;
text-shadow: 0 0 2px #fff, 0 0 10px var(--accent), 0 0 22px var(--accent), 0 0 44px color-mix(in oklch,var(--accent) 70%,transparent), 0 0 90px color-mix(in oklch,var(--accent) 40%,transparent);
}
.cnt-13__h em {
font-style: italic;
color: #ffe9fb;
}
@media (prefers-reduced-motion: reduce) {
}
```
## JavaScript
```js
/* No JavaScript — a single five-layer text-shadow, tight core to wide bloom. */
```How this works
The whole effect is one property done well. The text-shadow stacks five layers at growing blur radii: a near-zero white core for the hot filament, two mid-range coloured layers for the tube body, and two wide low-alpha layers for the room bloom. Ordering matters — tight-to-wide — so the letter edge stays crisp while the halo diffuses.
No animation, no script, no images: just semantic <h2> text that stays selectable, translatable and indexable. This is the baseline every other demo builds on.
Make it yours
- This is the recipe to memorise: white core → 2 colour body layers → 2 wide bloom layers. Adjust the five blur radii to taste.
- Recolour with
--accent; the body and bloom layers derive from it. - Add a sixth ultra-wide, very-low-alpha layer for a bigger room glow on true black.
- Wrap in an
<a>and add a:hoverthat widens the bloom for an interactive version.
Gotchas — read before shipping
- Layer order is the whole trick — a single fat blurry shadow looks like fog, not neon; keep the tight core first.
- Thin/serif faces lose their hairlines under a wide bloom; use a medium-or-heavier weight.
- Neon needs the dark background — this pattern assumes a near-black canvas behind it.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 16.2+ | 113+ | 111+ |
Floor set by oklch(), color-mix() as this demo is written. The core technique itself goes back further — Chrome 4+.
text-shadow is supported by literally every current browser; this is the maximum-compatibility neon.