Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Bubble Button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By @SyedImtiyaz
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 Bubble Button
Bubble Button is an animated CSS button by @SyedImtiyaz. 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 http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Bubble Button</title>
</head>
<body>
<button style="--content: 'Hover me!';">
<div class="left"></div>
Hover me!
<div class="right"></div>
</button>
</body>
</html>CSS
@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro:200,900');
:root {
--text-color: hsla(210, 50%, 85%, 1);
--shadow-color: hsla(210, 40%, 52%, .4);
--btn-color: hsl(210, 80%, 42%);
--bg-color: #141218;
}
* {
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--bg-color);
}
button {
position:relative;
padding: 10px 20px;
border: none;
background: none;
cursor: pointer;
font-family: "Source Code Pro";
font-weight: 900;
text-transform: uppercase;
font-size: 30px;
color: var(--text-color);
background-color: var(--btn-color);
box-shadow: var(--shadow-color) 2px 2px 22px;
border-radius: 4px;
z-index: 0;
overflow: hidden;
}
button:focus {
outline-color: transparent;
box-shadow: var(--btn-color) 2px 2px 22px;
}
.right::after, button::after {
content: var(--content);
display: block;
position: absolute;
white-space: nowrap;
padding: 40px 40px;
pointer-events:none;
}
button::after{
font-weight: 200;
top: -30px;
left: -20px;
}
.right, .left {
position: absolute;
width: 100%;
height: 100%;
top: 0;
}
.right {
left: 66%;
}
.left {
right: 66%;
}
.right::after {
top: -30px;
left: calc(-66% - 20px);
background-color: var(--bg-color);
color:transparent;
transition: transform .4s ease-out;
transform: translate(0, -90%) rotate(0deg)
}
button:hover .right::after {
transform: translate(0, -47%) rotate(0deg)
}
button .right:hover::after {
transform: translate(0, -50%) rotate(-7deg)
}
button .left:hover ~ .right::after {
transform: translate(0, -50%) rotate(7deg)
}
/* bubbles */
button::before {
content: '';
pointer-events: none;
opacity: .6;
background:
radial-gradient(circle at 20% 35%, transparent 0, transparent 2px, var(--text-color) 3px, var(--text-color) 4px, transparent 4px),
radial-gradient(circle at 75% 44%, transparent 0, transparent 2px, var(--text-color) 3px, var(--text-color) 4px, transparent 4px),
radial-gradient(circle at 46% 52%, transparent 0, transparent 4px, var(--text-color) 5px, var(--text-color) 6px, transparent 6px);
width: 100%;
height: 300%;
top: 0;
left: 0;
position: absolute;
animation: bubbles 5s linear infinite both;
}
@keyframes bubbles {
from {
transform: translate();
}
to {
transform: translate(0, -66.666%);
}
}