Build an html page that says hello world in every color of the rainbow
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Hello World in Rainbow</title>
<style>
:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
overflow: hidden;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
background: #090b20;
color: white;
}
body::before {
content: "";
position: fixed;
inset: -35%;
z-index: -1;
background: conic-gradient(from 90deg, #ef3340, #ff9f1c, #ffe66d, #35d07f, #27a9ff, #7157ff, #d946ef, #ef3340);
filter: blur(80px);
opacity: .28;
animation: turn 18s linear infinite;
}
main {
width: min(92vw, 900px);
padding: clamp(2rem, 8vw, 6rem) 1rem;
text-align: center;
}
.eyebrow {
margin: 0 0 1.2rem;
color: #dce4ff;
font-size: .8rem;
font-weight: 700;
letter-spacing: .28em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(3.6rem, 14vw, 10rem);
line-height: .95;
letter-spacing: -.08em;
text-wrap: balance;
filter: drop-shadow(0 12px 28px #0008);
}
h1 span {
display: inline-block;
animation: float 3.5s ease-in-out infinite;
animation-delay: calc(var(--i) * -120ms);
text-shadow: 0 0 22px color-mix(in srgb, var(--c), transparent 35%);
}
.red { --c:#ff3b4f; } .orange { --c:#ff9d24; }
.yellow { --c:#ffe04b; } .green { --c:#42e695; }
.blue { --c:#42b7ff; } .indigo { --c:#7667ff; }
.violet { --c:#db68ff; }
.note {
margin: 2rem auto 0;
max-width: 34rem;
color: #c5cbe7;
font-size: clamp(1rem, 2.5vw, 1.25rem);
}
button {
margin-top: 2rem;
border: 1px solid #ffffff55;
border-radius: 999px;
padding: .8rem 1.25rem;
color: white;
background: #ffffff18;
font: inherit;
font-weight: 700;
cursor: pointer;
backdrop-filter: blur(8px);
}
button:hover { background: #ffffff2b; transform: translateY(-2px); }
button:focus-visible { outline: 3px solid white; outline-offset: 4px; }
.spark {
position: fixed;
width: 7px; height: 7px;
border-radius: 50%;
background: var(--c);
box-shadow: 0 0 18px 4px var(--c);
pointer-events: none;
animation: rise 1.5s ease-out forwards;
}
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes float {
0%,100% { transform: translateY(0) rotate(0); }
50% { transform: translateY(-.12em) rotate(2deg); }
}
@keyframes rise {
to { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
</style>
</head>
<body>
<main>
<p class="eyebrow">A spectrum of greetings</p>
<h1 aria-label="hello world">
<span class="red" style="--i:0">H</span><span class="orange" style="--i:1">e</span><span class="yellow" style="--i:2">l</span><span class="green" style="--i:3">l</span><span class="blue" style="--i:4">o</span>
<span aria-hidden="true"> </span>
<span class="indigo" style="--i:5">W</span><span class="violet" style="--i:6">o</span><span class="red" style="--i:7">r</span><span class="orange" style="--i:8">l</span><span class="yellow" style="--i:9">d</span>
</h1>
<p class="note">One tiny phrase, glowing in every color of the rainbow.</p>
<button type="button" id="celebrate">Make it sparkle ✨</button>
</main>
<script>
const button = document.querySelector("#celebrate");
const colors = ["#ff3b4f","#ff9d24","#ffe04b","#42e695","#42b7ff","#7667ff","#db68ff"];
button.addEventListener("click", () => {
for (let i = 0; i < 28; i++) {
const dot = document.createElement("i");
dot.className = "spark";
dot.style.setProperty("--c", colors[i % colors.length]);
dot.style.left = `${50 + (Math.random() - .5) * 32}%`;
dot.style.top = `${48 + (Math.random() - .5) * 12}%`;
dot.style.setProperty("--x", `${(Math.random() - .5) * 280}px`);
dot.style.setProperty("--y", `${-80 - Math.random() * 180}px`);
document.body.append(dot);
dot.addEventListener("animationend", () => dot.remove());
}
});
</script>
</body>
</html>
Nothing. This page is entirely self-contained and contacts no other website when it runs.
Published on Globefin under the MIT License. You may copy, change, and reuse this page, including commercially — just keep the notice below with it.
Copyright © 2026 Zabella Roman. Licensed under the MIT License. Published on Globefin.
Provided as is, without warranty. Any external libraries it loads keep their own licences. Terms →
Scripts run, but the demo has its own throwaway origin. It can't read your session or cookies, can't reach the page around it, and can't navigate your tab. Don't enter real passwords or personal data into any demo.