Melting Text
The text written in the HTML is split into letters that drop, stretch and blur one after another before rising again, in a wave, across a range of hues.
Updated
This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Distortion has 31 effects, including 5 free. Explore the category →
3 usage examples



How it works
On load, the script goes through every .fx-0254-root .mlt-text, reads its text (multiple spaces reduced to one) and keeps it intact in a <span class="mlt-sr">, invisible on screen but read by screen readers. Next to it, it builds a visual copy .mlt-letters (aria-hidden="true"): one .mlt-word per word, one .mlt-letter per letter, each with its rank in --mlt-i. The text therefore comes from the HTML: change it and the split follows.
Each letter plays mltMelt over 2 s: halfway through it has dropped 0.21 em (10 px at the default 3rem size), stretched to 120% of its height and blurred by 1 px, then it comes back. Its start is delayed by 0.1 s per rank (calc(var(--mlt-i) * var(--mlt-delay))), hence the left-to-right wave. Despite the name, nothing drips: the letters always return to their place.
The colour is computed in CSS: hsl(calc(var(--mlt-hue) + var(--mlt-i) * var(--mlt-hue-step)), 70%, 60%). By default, 260° (violet) plus 15° per letter: the M is violet, the G pinkish red. Words never break (white-space: nowrap on .mlt-word); a line that is too long wraps between two words.
The root centres the text in at least 300 px of height on a #0a0a0f background; --mlt-height: auto and --mlt-bg: transparent fit it into your page. Every root on the page is split by the same pass of the script, and text that is already split is left alone.
Accessibility
- Screen readers: the phrase is read in one go thanks to
.mlt-sr, while the animated letters are hidden witharia-hidden. Measured in all three engines: "M E L T I N G" letter by letter before the repair, "MELTING" after. - Reduced motion: under
prefers-reduced-motion: reduce, the animation is removed; the letters stay upright and still, with their range of hues. - Flashing: none. The 1 px blur and the drop barely change brightness (frame-by-frame measurement: 0 cells above 3 changes per second).
- Contrast: the 60% lightness is written in the
.mlt-letterrule. It suits a dark background; on a light one, replace60%with about35%in that rule and in.mlt-text. - No interaction: the text is not focusable and reacts to neither pointer nor keyboard; it can sit on a heading (
<h1>,<p>) without changing its meaning.
Browser compatibility
CSS (2 KB) and 1 KB of JavaScript, no dependency. CSS variables, calc() inside hsl() and animation-delay, filter: blur(), Array.from, which does not cut in half characters stored as two units (emoji, some symbols). Measured in Chromium 151, Firefox 153 and WebKit 26.5: same look as the previous version, text read from the HTML for two different copies, no overflow at 390 px, 0 errors.
Without JavaScript, the text shows as written, in a single hue (the starting one), still. Without filter, the letters drop and stretch with no blur.
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="fx-0254-root">
<div class="mlt-text">Your text</div>
</div>
One-time payment, no subscription — the code is yours forever
Customize
Options passed to the API or data-* attributes:
| Option / property | Default | Effect |
|---|---|---|
Text (HTML — content of .mlt-text) |
MELTING | Write any text, accents and spaces included: the script splits it on load. |
--mlt-size |
3rem | Text size. The drop is in em, so it follows the size. |
--mlt-hue · --mlt-hue-step |
260 · 15 | Hue of the first letter (0 to 360) and hue added for each letter. --mlt-hue-step: 0 gives a single colour; 18 and 3 give amber tones. |
--mlt-drop |
.21em | How far letters drop halfway (10 px at 3rem). 0.4em for a heavier sag. |
--mlt-stretch · --mlt-blur |
1.2 · 1px | Vertical stretch and blur at the lowest point. Lower the blur (0.4px) on small text to keep letters readable. |
--mlt-speed · --mlt-delay |
2s · .1s | Length of one drop and rise, and delay between two letters. On long text, cut the delay (0.05s) so the wave does not stretch too far. |
--mlt-bg · --mlt-height |
#0a0a0f · 300px | Root background and minimum height. transparent and auto to place the text in your layout. |
FAQ
el.textContent = 'New text') and call the function again: the element no longer has .mlt-letters, so it is split afresh.--mlt-delay to keep the wave tight.