Live preview
Preview settings
Changes appear as you type. Use Tab to test keyboard focus.
⌘ / Ctrl + S saves locally
Macbook Command button-Anish Kothari
HTML, CSS or Tailwind, and a little JavaScript. One button or a group of up to six.
By @Anish
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 Macbook Command button-Anish Kothari
Macbook Command button-Anish Kothari is an animated CSS button by @Anish. 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
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Macbook Command button-Anish Kothari</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<button class="button">
<div class="button__content">
<div class="button__icon">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="80px" height="80px" viewBox="0 0 80 80" style="enable-background:new 0 0 80 80;" xml:space="preserve">
<g>
<path d="M64,48L64,48h-8V32h8c8.836,0,16-7.164,16-16S72.836,0,64,0c-8.837,0-16,7.164-16,16v8H32v-8c0-8.836-7.164-16-16-16
S0,7.164,0,16s7.164,16,16,16h8v16h-8l0,0l0,0C7.164,48,0,55.164,0,64s7.164,16,16,16c8.837,0,16-7.164,16-16l0,0v-8h16v7.98
c0,0.008-0.001,0.014-0.001,0.02c0,8.836,7.164,16,16,16s16-7.164,16-16S72.836,48.002,64,48z M64,8c4.418,0,8,3.582,8,8
s-3.582,8-8,8h-8v-8C56,11.582,59.582,8,64,8z M8,16c0-4.418,3.582-8,8-8s8,3.582,8,8v8h-8C11.582,24,8,20.417,8,16z M16,72
c-4.418,0-8-3.582-8-8s3.582-8,8-8l0,0h8v8C24,68.418,20.418,72,16,72z M32,48V32h16v16H32z M64,72c-4.418,0-8-3.582-8-8l0,0v-8
h7.999c4.418,0,8,3.582,8,8S68.418,72,64,72z"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
</div>
<p class="button__text">command</p>
</div>
</button>
</body>
</html>
CSS
@import url("https://fonts.googleapis.com/css?family=Roboto&display=swap");
* {
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
html, body {
height: 100%;
touch-action: manipulation;
}
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-family: "Roboto", sans-serif;
background-color: #f4f5f6;
font-size: 14px;
color: #666666;
}
.button {
position: relative;
padding: 0;
width: 200px;
height: 200px;
border: 4px solid #888888;
outline: none;
background-color: #f4f5f6;
border-radius: 40px;
box-shadow: -6px -20px 35px #ffffff, -6px -10px 15px #ffffff, -20px 0px 30px #ffffff, 6px 20px 25px rgba(0, 0, 0, 0.2);
transition: 0.13s ease-in-out;
cursor: pointer;
}
.button:active {
box-shadow: none;
}
.button:active .button__content {
box-shadow: none;
}
.button:active .button__content .button__text, .button:active .button__content .button__icon {
transform: translate3d(0px, 0px, 0px);
}
.button__content {
position: relative;
display: grid;
padding: 20px;
width: 100%;
height: 100%;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr;
box-shadow: inset 0px -8px 0px #dddddd, 0px -8px 0px #f4f5f6;
border-radius: 40px;
transition: 0.13s ease-in-out;
z-index: 1;
}
.button__icon {
position: relative;
display: flex;
transform: translate3d(0px, -4px, 0px);
grid-column: 4;
align-self: start;
justify-self: end;
width: 32px;
height: 32px;
transition: 0.13s ease-in-out;
}
.button__icon svg {
width: 32px;
height: 32px;
fill: #aaaaaa;
}
.button__text {
position: relative;
transform: translate3d(0px, -4px, 0px);
margin: 0;
align-self: end;
grid-column: 1/5;
grid-row: 2;
text-align: center;
font-size: 32px;
background-color: #888888;
color: transparent;
text-shadow: 2px 2px 3px rgba(255, 255, 255, 0.5);
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
transition: 0.13s ease-in-out;
}
.credits {
margin-top: 24px;
}
.credits__reference {
display: inline-block;
border-bottom: 1px solid transparent;
color: #0099ff;
text-decoration: none;
transition: ease-in 0.13s;
}
.credits__reference:hover {
border-bottom-color: #0099ff;
}