Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Samriddhi15's button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By @Samriddhi15
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 Samriddhi15's button
Samriddhi15's button is an animated CSS button by @Samriddhi15. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Hover effects, 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 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>Document</title>
</head>
<body>
<div class="container">
<div class="radio-tile-group">
<div class="input-container">
<input id="walk" type="radio" name="radio">
<div class="radio-tile">
<ion-icon name="walk"></ion-icon>
<label for="walk">Walk</label>
</div>
</div>
<div class="input-container">
<input id="bike" type="radio" name="radio">
<div class="radio-tile">
<ion-icon name="bicycle"></ion-icon>
<label for="bike">Bike</label>
</div>
</div>
<div class="input-container">
<input id="car" type="radio" name="radio">
<div class="radio-tile">
<ion-icon name="car-sport"></ion-icon>
<label for="car">Drive</label>
</div>
</div>
<div class="input-container">
<input id="fly" type="radio" name="radio">
<div class="radio-tile">
<ion-icon name="airplane"></ion-icon>
<label for="fly">Fly</label>
</div>
</div>
</div>
</div>
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
<!-- <button class="btn">Click Me</button> -->
<script src="./app.js"></script>
</body>
</html>
CSS
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #212121;
}
/*
1. Add your styles below this.
2. Don't change the above code.
3. You can change the background color of the body.
4. Remove the comments.
*/
:root {
--primary-color: #07afd9;
}
* {
box-sizing: border-box;
font-family: sans-serif;
}
body {
background-color: #1E2B35;
overflow: hidden;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.radio-tile-group {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.input-container {
position: relative;
height: 7rem;
width: 7rem;
margin: 0.5rem;
}
.input-container input {
position: absolute;
height: 100%;
width: 100%;
margin: 0;
cursor: pointer;
z-index: 2;
opacity: 0;
}
.input-container .radio-tile {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
border: 2px solid var(--primary-color);
border-radius: 8px;
transition: all 300ms ease;
}
.input-container ion-icon {
color: var(--primary-color);
font-size: 3rem;
}
.input-container label {
color: var(--primary-color);
font-size: 0.80rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
}
input:checked+.radio-tile {
background-color: var(--primary-color);
box-shadow: 0 0 12px var(--primary-color);
transform: scale(1.1);
}
input:hover+.radio-tile {
box-shadow: 0 0 12px var(--primary-color);
}
input:checked+.radio-tile ion-icon,
input:checked+.radio-tile label {
color: white;
}JavaScript
// Add Your button script here