Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
ybhavu's button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By @ybhavu
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 ybhavu's button
ybhavu's button is an animated CSS button by @ybhavu. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Minimal
- 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 http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button class="button">Button</button>
<button class="button">Button</button>
<button class="button">Button</button>
</body>
</html>CSS
html,
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
font-size: 100%;
height: 100%;
margin: 0;
padding: 0;
}
body {
background: #970c23;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
line-height: 1;
position: relative;
}
body::before {
background: repeating-linear-gradient(
transparent,
transparent 2em,
rgba(45,25,25,0.3) 2em,
rgba(45,25,25,0.3) 2.5em,
transparent 2.5em,
transparent 4.5em,
rgba(45,25,25,0.3) 4.5em,
rgba(45,25,25,0.3) 6.5em,
transparent 6.5em,
transparent 7em,
rgba(45,25,25,0.3) 7em,
rgba(45,25,25,0.3) 9em
);
content: '';
bottom: 0;
top: 0;
left: 0;
right: 0;
position: absolute;
}
body::after {
background: repeating-linear-gradient( 90deg,
transparent,
transparent 2em,
rgba(45,25,25,0.3) 2em,
rgba(45,25,25,0.3) 2.5em,
transparent 2.5em,
transparent 4.5em,
rgba(45,25,25,0.3) 4.5em,
rgba(45,25,25,0.3) 6.5em,
transparent 6.5em,
transparent 7em,
rgba(45,25,25,0.3) 7em,
rgba(45,25,25,0.3) 9em
);
content: '';
bottom: 0;
top: 0;
left: 0;
right: 0;
position: absolute;
}
.button {
background: #4d6b61;
border: 0;
border-radius: 50%;
box-shadow: inset -0.125rem -0.25rem rgba(0,0,0,0.2),
inset 0.125rem 0.25rem rgba(255,255,255,0.2),
0.125rem 0.25rem 0.25rem rgba(0,0,0,0.35);
color: #4d6b61;
display: inline-block;
font-size: 0.625em;
letter-spacing: 0.25em;
text-transform: uppercase;
text-align: center;
text-decoration: none;
text-shadow: 1px 1px 1px rgba(0,0,0,0.3), -1px -1px 1px rgba(255,255,255,0.4);
height: 8rem;
width: 8rem;
position: relative;
z-index: 1;
}
.button::before {
content: '';
border-radius: 50%;
box-shadow: inset -0.0625rem -0.125rem rgba(255,255,255,0.2),
inset 0.0625rem 0.125rem rgba(0,0,0,0.2);
position: absolute;
top: 1rem;
left: 1rem;
height: 6rem;
width: 6rem;
}
.button::after {
content: '';
border-radius: 50%;
box-shadow: 2.45rem 2.45rem #462227,
2.45rem 4.45rem #462227,
4.45rem 2.45rem #462227,
4.45rem 4.45rem #462227,
2.55rem 2.55rem rgba(255,255,255,0.2),
2.55rem 4.55rem rgba(255,255,255,0.2),
4.55rem 2.55rem rgba(255,255,255,0.2),
4.55rem 4.55rem rgba(255,255,255,0.2),
2.35rem 2.35rem rgba(0,0,0,0.2),
2.35rem 4.35rem rgba(0,0,0,0.2),
4.35rem 2.35rem rgba(0,0,0,0.2),
4.35rem 4.35rem rgba(0,0,0,0.2);
position: absolute;
top: 0;
left: 0;
height: 1rem;
width: 1rem;
}
.button:focus {
background: #56796d;
outline:0;
}
.button:active {
transform: scale(0.98,0.98);
}
/* Hide buttons on small screens */
@media only screen and (max-height: 440px) {
button:nth-child(3) {
display: none;
}
}
@media only screen and (max-height: 300px) {
button:nth-child(2) {
display: none;
}
}