Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
CSS 3D checkbox
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 CSS 3D checkbox
CSS 3D checkbox is an animated CSS button by @Kalivarapubindusree. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Toggle, Icon
- 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>
<head>
<meta charset="utf-8">
<title> CSS 3D checkbox</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" integrity="sha512-MV7K8+y+gLIBoVD59lQIYicR65iaqukzvf/nwasF0nqhPay5w/9lJmVM2hMDcnK1OnMGCdVK+iQrJ7lzPJQd1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class ="buttons">
<label>
<input type="checkbox" name="check">
<span>
</span>
<i class="fa-solid fa-phone"></i>
</label>
<label>
<input type="checkbox" name="check">
<span>
</span>
<i class="fa-solid fa-plane"></i>
</label><label>
<input type="checkbox" name="check">
<span>
</span>
<i class="fa-solid fa-moon"></i>
</label><label>
<input type="checkbox" name="check">
<span>
</span>
<i class="fa-solid fa-wifi"></i>
</label><label>
<input type="checkbox" name="check">
<span>
</span>
<i class="fa-solid fa-volume-xmark"></i>
</label><label>
<input type="checkbox" name="check">
<span>
</span>
<i class="fa-brands fa-bluetooth-b"></i>
</label>
</div>
</body>
</html>
CSS
*
{
margin:0;
padding:0;
box-sizing:border-box;
}
body
{
display:flex;
justify-content:center;
align-items:center;
min-height:100vh;
background:#333;
}
.buttons
{
display:flex;
justify-content:center;
align-items:center;
flex-wrap:wrap;
max-width:140px;
gap:20px;
}
.buttons label
{
position:relative;
width:60px;
height:60px;
display:flex;
justify-content:center;
align-items:center;
cursor:pointer;
}
.buttons label input
{
appearance:none;
}
.buttons label span
{
position:absolute;
width:100%;
height:100%;
background:linear-gradient(#555353,#363535,#303030);
border:2px solid #222;
border-radius:6px;
box-shadow:inset 0 5px 1px rgba(0,0,0,0.35),
0 5px 5px rgba(0,0,0,0.5),
0 15px 25px rgba(0,0,0,0.35);
}
.buttons label input:checked ~ span
{
box-shadow:inset 0 2px 2px rgba(0,0,0,0.35),
inset 0 5px 5px rgba(0,0,0,0.5),
inset 0 15px 25px rgba(0,0,0,0.35);
}
.buttons label span::before
{
content: '';
position:absolute;
inset:5px 3px;
border-top:1px solid #ccc;
filter:blur(2px);
}
.buttons label i
{
position:relative;
z-index:10;
font-size:1.5em;
color:#111;
}
.buttons label input:checked ~ i
{
color:#fff;
text-shadow: 0 0 5px #219cf3,
0 0 8px #219cf3;
}