Focus Lens
Interactive & Advanced · Static · pure CSS
The word is soft and out of focus everywhere except a sharp disc under your cursor, which tracks the pointer like a magnifying lens.
How it works
Focus Lens is a static interactive & advanced text effect rendered entirely in CSS. A data-text attribute mirrors the word into ::before/::after layers, so copy that attribute together with the CSS. It reacts to the pointer through CSS custom properties updated by a tiny inline script.
Controls
Focus Lens exposes 3 dedicated controls — Hue, Blur and Lens Size — on top of the shared type controls (font, weight, letter-spacing and case). Open it in the generator to tune every value live, then copy the updated CSS.
CSS
/* Focus Lens — generated with TEXT-FX
* HTML: the element needs a data-text attribute equal to its text; needs the small pointer-move JS snippet.
* Font: 'Major Mono Display', monospace (load from Google Fonts).
*/
.text-effect {
font-family: 'Major Mono Display', monospace;
font-weight: 700;
letter-spacing: 8px;
text-transform: none;
}
.text-effect {
--mx: 50%;
--my: 50%;
position: relative;
color: transparent;
}
.text-effect::before,
.text-effect::after {
content: attr(data-text);
position: absolute;
inset: 0;
color: hsl(38 55% 80%);
pointer-events: none;
}
.text-effect::before {
color: hsl(38 22% 52%);
filter: blur(9px);
}
.text-effect::after {
-webkit-mask-image: radial-gradient(circle at var(--mx) var(--my), #000 0%, #000 32%, transparent 50%);
mask-image: radial-gradient(circle at var(--mx) var(--my), #000 0%, #000 32%, transparent 50%);
}
HTML
This effect needs the markup below (per-letter spans, SVG defs, or a data-text attribute).
<style>
.text-effect {
font-family: 'Major Mono Display', monospace;
font-weight: 700;
letter-spacing: 8px;
text-transform: none;
}
.text-effect {
--mx: 50%;
--my: 50%;
position: relative;
color: transparent;
}
.text-effect::before,
.text-effect::after {
content: attr(data-text);
position: absolute;
inset: 0;
color: hsl(38 55% 80%);
pointer-events: none;
}
.text-effect::before {
color: hsl(38 22% 52%);
filter: blur(9px);
}
.text-effect::after {
-webkit-mask-image: radial-gradient(circle at var(--mx) var(--my), #000 0%, #000 32%, transparent 50%);
mask-image: radial-gradient(circle at var(--mx) var(--my), #000 0%, #000 32%, transparent 50%);
}
</style>
<div data-text="Your text" class="text-effect">Your text</div>
<script>
const fx = document.querySelector('.text-effect');
if (fx) {
fx.addEventListener('pointermove', (e) => {
const r = fx.getBoundingClientRect();
if (!r.width || !r.height) return;
fx.style.setProperty('--mx', ((e.clientX - r.left) / r.width) * 100 + '%');
fx.style.setProperty('--my', ((e.clientY - r.top) / r.height) * 100 + '%');
});
fx.addEventListener('pointerleave', () => {
fx.style.removeProperty('--mx');
fx.style.removeProperty('--my');
});
}
</script>
- Category
- Interactive & Advanced
- Type
- Static
- Browser support
- Blurred copy + a pointer-tracked sharp disc — static preview is centred.
- Capabilities
- dataText, pointer