Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Mail Button
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By @Nishusk
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 Mail Button
Mail Button is an animated CSS button by @Nishusk. Preview the interaction, customize its HTML, styles and JavaScript, or download the files with creator credit.
- Effects and categories
- Hover effects, 3D
- 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>Mail Button</title>
</head>
<body>
<div class="letter-image">
<div class="animated-mail">
<div class="back-fold"></div>
<div class="letter">
<div class="letter-border"></div>
<div class="letter-title"></div>
<div class="letter-context"></div>
<div class="letter-stamp">
<div class="letter-stamp-inner"></div>
</div>
</div>
<div class="top-fold"></div>
<div class="body"></div>
<div class="left-fold"></div>
</div>
<div class="shadow"></div>
</div>
</body>
</html>
CSS
body {
background: #161616;
}
.letter-image {
position: absolute;
top: 50%;
left: 50%;
width: 200px;
height: 200px;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
cursor: pointer;
}
.animated-mail {
position: absolute;
height: 150px;
width: 200px;
-webkit-transition: 0.4s;
-moz-transition: 0.4s;
transition: 0.4s;
}
.animated-mail .body {
position: absolute;
bottom: 0;
width: 0;
height: 0;
border-style: solid;
border-width: 0 0 100px 200px;
border-color: transparent transparent #DC5B51 transparent;
z-index: 2;
}
.animated-mail .top-fold {
position: absolute;
top: 50px;
width: 0;
height: 0;
border-style: solid;
border-width: 50px 100px 0 100px;
-webkit-transform-origin: 50% 0%;
-webkit-transition: transform 0.4s 0.4s, z-index 0.2s 0.4s;
-moz-transform-origin: 50% 0%;
-moz-transition: transform 0.4s 0.4s, z-index 0.2s 0.4s;
transform-origin: 50% 0%;
transition: transform 0.4s 0.4s, z-index 0.2s 0.4s;
border-color: #cf4a43 transparent transparent transparent;
z-index: 2;
}
.animated-mail .back-fold {
position: absolute;
bottom: 0;
width: 200px;
height: 100px;
background: #cf4a43;
z-index: 0;
}
.animated-mail .left-fold {
position: absolute;
bottom: 0;
width: 0;
height: 0;
border-style: solid;
border-width: 50px 0 50px 100px;
border-color: transparent transparent transparent #e15349;
z-index: 2;
}
.animated-mail .letter {
left: 20px;
bottom: 0px;
position: absolute;
width: 160px;
height: 60px;
background: white;
z-index: 1;
overflow: hidden;
-webkit-transition: 0.4s 0.2s;
-moz-transition: 0.4s 0.2s;
transition: 0.4s 0.2s;
}
.animated-mail .letter .letter-border {
height: 10px;
width: 100%;
background: repeating-linear-gradient(-45deg, #cb5a5e, #cb5a5e 8px, transparent 8px, transparent 18px);
}
.animated-mail .letter .letter-title {
margin-top: 10px;
margin-left: 5px;
height: 10px;
width: 40%;
background: #DC5B51;
}
.animated-mail .letter .letter-context {
margin-top: 10px;
margin-left: 5px;
height: 10px;
width: 20%;
background: #DC5B51;
}
.animated-mail .letter .letter-stamp {
margin-top: 30px;
margin-left: 120px;
border-radius: 100%;
height: 30px;
width: 30px;
background: #DC5B51;
opacity: 0.3;
}
.shadow {
position: absolute;
top: 200px;
left: 50%;
width: 400px;
height: 30px;
transition: 0.4s;
transform: translateX(-50%);
-webkit-transition: 0.4s;
-webkit-transform: translateX(-50%);
-moz-transition: 0.4s;
-moz-transform: translateX(-50%);
border-radius: 100%;
background: radial-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0), rgba(0, 0, 0, 0));
}
.letter-image:hover .animated-mail {
transform: translateY(50px);
-webkit-transform: translateY(50px);
-moz-transform: translateY(50px);
}
.letter-image:hover .animated-mail .top-fold {
transition: transform 0.4s, z-index 0.2s;
transform: rotateX(180deg);
-webkit-transition: transform 0.4s, z-index 0.2s;
-webkit-transform: rotateX(180deg);
-moz-transition: transform 0.4s, z-index 0.2s;
-moz-transform: rotateX(180deg);
z-index: 0;
}
.letter-image:hover .animated-mail .letter {
height: 180px;
}
.letter-image:hover .shadow {
width: 250px;
}JavaScript
// Add Your button script here