Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Rainbow Button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
Button submission checks
Checks will appear after the preview updates.
Buttons only: no full pages, forms, cards or navigation. Put scripts in the JavaScript tab. Tailwind uses utilities from HTML and JavaScript; use complete class names. Custom CSS supports plain CSS, without @apply, imports or plugins.
Accessibility quick check
Waiting for the rendered preview…
Try Tab, Enter and Space in the preview. Check the focus ring, hover and disabled states, then enable Reduce motion. These checks are guidance, not an accessibility certification.
Explore freely here. Remix to publish your version with credit to the creator.
About Rainbow Button
Rainbow Button is an animated CSS button by @utkarshjaulkar. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Hover effects, Animated
- Using this example
- Copy the HTML or download index.html, style.css and app.js. Test keyboard focus, motion and contrast in your own project.
Usage, Tailwind and licensing questions
Read the source files
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Rainbow Button</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container text-center">
<h1 class=""> Animated buttons with
<span class="a">r</span><span class="b">a</span><span class="c">i</span><span class="d">n</span><span class="e">b</span><span class="f">o</span><span class="a">w</span> hover </h1>
<div class="flex">
<a class="rainbow rainbow-1">Click Me!<a/>
<a class="rainbow rainbow-2">Click Me!<a/>
<a class="rainbow rainbow-3">Click Me!<a/>
<a class="rainbow rainbow-4">Click Me!<a/>
<a class="rainbow rainbow-5">Click Me!<a/>
</div>
</body>
</html>
CSS
@import url("https://fonts.googleapis.com/css?family=Nunito:400,600,700");
body {
font-family: "Nunito", sans-serif;
}
.a {
color: #e7484f;
}
.b {
color: #f68b1d;
}
.c {
color: #fced00;
}
.d {
color: #009e4f;
}
.e {
color: #00aac3;
}
.f {
color: #732982;
}
.container {
margin-top: 150px;
}
.text-center {
text-align: center;
}
.rainbow {
background-color: #343a40;
border-radius: 4px;
color: #fff;
cursor: pointer;
padding: 8px 16px;
}
.rainbow-1:hover {
background-image: linear-gradient(
90deg,
#00c0ff 0%,
#ffcf00 49%,
#fc4f4f 80%,
#00c0ff 100%
);
animation: slidebg 5s linear infinite;
}
.rainbow-2:hover {
background-image: linear-gradient(
to right,
red,
orange,
yellow,
green,
blue,
indigo,
violet,
red
);
animation: slidebg 2s linear infinite;
}
.rainbow-3:hover {
background-image: linear-gradient(
to right,
red,
orange,
yellow,
green,
blue,
indigo,
red
);
animation: slidebg 2s linear infinite;
}
.rainbow-4:hover {
background-image: linear-gradient(
to right,
#e7484f,
#f68b1d,
#fced00,
#009e4f,
#00aac3,
#732982
);
animation: slidebg 2s linear infinite;
}
.rainbow-5:hover {
background-image: linear-gradient(
to right,
#e7484f,
#e7484f 16.65%,
#f68b1d 16.65%,
#f68b1d 33.3%,
#fced00 33.3%,
#fced00 49.95%,
#009e4f 49.95%,
#009e4f 66.6%,
#00aac3 66.6%,
#00aac3 83.25%,
#732982 83.25%,
#732982 100%,
#e7484f 100%
);
animation: slidebg 2s linear infinite;
}
@keyframes slidebg {
to {
background-position: 20vw;
}
}
.flex {
display: flex;
/* flex-wrap: 10px; */
flex-direction: column;
justify-content: space-between;
align-items: center;
justify-items: center;
}
.flex a {
margin: 2px;
width: 100px;
}
/*
@media only screen and (max-width: 600px) {
.flex {