Make the hero a stacking context
The light sits behind the content but inside the hero, so the hero needs three things:
position: relativeso the light can be placed inside it,overflow: hiddenso the blurred edges do not spill onto the next section, andisolation: isolateso a negativez-indexstays inside the hero instead of sinking behind the page.The dark background matters too. Light reads as light only against something darker, which is why the aurora on this site sits on
#080813.
Three rules keep the light inside the hero. aurora.cssCSS .hero { position: relative; overflow: hidden; isolation: isolate; background: #080813; }Paint three radial gradients on one layer
One absolutely positioned layer carries all three lights as stacked
radial-gradient()backgrounds: violet, indigo and pink, each placed withat x% y%and fading totransparentby 70%. The layer is larger than the hero (the negativeinsetand 120% height) so the blur never shows a hard edge.filter: blur(70px)turns three blobs into light, and 90% opacity stops it overpowering the text. These are the exact values in thelab-auroraclass on this site.
The same three gradients, before and after the blur. aurora.cssCSS .aurora-bg { position: absolute; inset: -25% -15% auto -15%; height: 120%; z-index: -1; pointer-events: none; opacity: 0.9; filter: blur(70px); background-image: radial-gradient(32% 38% at 28% 30%, #7453FE 0%, transparent 70%), radial-gradient(28% 34% at 72% 26%, #3F4BDA 0%, transparent 70%), radial-gradient(26% 30% at 56% 62%, #F93CBB 0%, transparent 70%); }After step 2: three blurred lights behind the headline, standing still. Josh W. Comeau explains why gradients between two strong colours can turn grey in the middle:
By mixing two highly-saturated colors together, we wind up with a totally-desaturated color.
Josh W. Comeau, Make Beautiful Gradients in CSS That is the reason each light fades to
transparentrather than into its neighbour. The colours never mix with each other inside one gradient; they overlap as separate layers over a dark background, and the blur blends them as light. The result stays saturated where a single violet-to-pink gradient would have greyed in the middle.Let the light drift with @keyframes
The drift moves the whole layer a few per cent, rotates it a few degrees and scales it slightly. Only
transformchanges, which browsers can animate without re-laying out the page, andalternateplays it forwards then backwards so there is never a jump.When I built this site, Elementor 4 did not keep animation properties inside a global class, so the keyframes and the
animationline live in one Custom Code snippet (Elementor > Custom Code, location<head>). Without Elementor Pro, Appearance > Customize > Additional CSS does the same job. The gradients themselves can stay in the class.aurora.cssCSS @keyframes aurora-drift { 0% { transform: translate3d(-3%, 2%, 0) rotate(0deg) scale(1); } 50% { transform: translate3d(3%, -3%, 0) rotate(6deg) scale(1.06); } 100% { transform: translate3d(-1%, -5%, 0) rotate(-4deg) scale(1.02); } } .aurora-bg { animation: aurora-drift 18s ease-in-out infinite alternate; will-change: transform; }After step 3: the layer drifts and turns a few degrees over 18 seconds, then eases back. Build the hero in Elementor 4
Give the hero container the class
hero. Add a Div Block as its first child, leave it empty and give it the classaurora-bg. Your heading and text go after it. Elementor 4 prints a global class under the name you give it, so the CSS finds both elements with no extra selectors.On this site the same class sits behind every hero, the closing band on each page and the five panels of the mega menu, which you can see on the Test365i home page and in the Elementor 4 element gallery. The HTML below is the same structure outside Elementor:

Two classes and one empty div block; the animation lives in Custom Code. index.htmlHTML <section class="hero"> <div class="aurora-bg"></div> <h1>Your headline</h1> <p>Your supporting line.</p> </section>Calm it for people who prefer less motion
A drifting background is movement nobody asked for, so it should stop for anyone whose device asks for reduced motion. The light stays; only the drift goes. The spinning gradient border uses the same rule.
aurora.cssCSS @media (prefers-reduced-motion: reduce) { .aurora-bg { animation: none; } }The finished aurora. Turn on Reduce motion in your device settings and the lights stop drifting. MDN describes what the reduced-motion media query reports:
Indicates that a user has enabled the setting on their device for reduced motion.
MDN Web Docs, prefers-reduced-motion reference It is a setting the visitor chose, often because movement makes them unwell. Respecting it costs three lines and loses nothing that matters: the aurora still frames the hero, it just stops moving.
What the aurora background does not do
It needs a dark background. On white, three blurred gradients look like smudges rather than light.
A large filter: blur() layer costs some painting work. One aurora per section is fine; dozens of animated ones on a long page are not.
It is decoration. Keep text contrast measured against the darkest and the brightest part of the light, as this site does.
All the aurora background code
Each file below is complete. Copy it, or download it under the name shown.
.hero {
position: relative;
overflow: hidden;
isolation: isolate;
background: #080813;
}
.aurora-bg {
position: absolute;
inset: -25% -15% auto -15%;
height: 120%;
z-index: -1;
pointer-events: none;
opacity: 0.9;
filter: blur(70px);
background-image:
radial-gradient(32% 38% at 28% 30%, #7453FE 0%, transparent 70%),
radial-gradient(28% 34% at 72% 26%, #3F4BDA 0%, transparent 70%),
radial-gradient(26% 30% at 56% 62%, #F93CBB 0%, transparent 70%);
}
@keyframes aurora-drift {
0% { transform: translate3d(-3%, 2%, 0) rotate(0deg) scale(1); }
50% { transform: translate3d(3%, -3%, 0) rotate(6deg) scale(1.06); }
100% { transform: translate3d(-1%, -5%, 0) rotate(-4deg) scale(1.02); }
}
.aurora-bg {
animation: aurora-drift 18s ease-in-out infinite alternate;
will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
.aurora-bg { animation: none; }
}<section class="hero">
<div class="aurora-bg"></div>
<h1>Your headline</h1>
<p>Your supporting line.</p>
</section>Aurora background questions
Does the aurora background need JavaScript?
No. It is three CSS radial gradients, a blur filter and a keyframe animation.
Can I change the colours?
Yes. Swap the three colour values in the radial-gradient() lines. Keep each one fading to transparent so they do not mix into grey.
Why is the layer bigger than the hero?
A blur fades the edges of whatever it blurs. Making the layer larger than the hero and clipping it with overflow: hidden keeps the visible edges soft.
Will the animation hurt page speed?
It animates only transform, so it does not shift layout. This site scores 100 for performance on mobile with an aurora on every page.
Can I use it in Elementor without Elementor Pro?
Yes. The gradients can go in the class, and the keyframes go in Appearance > Customize > Additional CSS instead of Custom Code.
Does it work on a light background?
Not well. Light only reads as light against something darker, so it suits dark sections.
How do I stop it moving for some visitors?
The prefers-reduced-motion media query in step 5 stops the drift for anyone whose device asks for less motion.
Can I add a matching glow to cards on top?
Yes. A soft coloured box-shadow picks up the aurora colours. Box Shadow Generator, made by Mark McNeece of 365i, builds one you can copy.