<div class="keyboard-board">
<button class="mech-key">
<div class="key-cap">
<span class="key-legend">ENTER</span>
</div>
<div class="key-base"></div>
</button>
</div>*, *::before, *::after {
box-sizing: border-box;
}
body {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
margin: 0;
background: #18181b;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.keyboard-board {
background: #27272a;
padding: 40px;
border-radius: 16px;
box-shadow: 0 20px 40px rgba(0,0,0,0.8), inset 0 2px 2px rgba(255,255,255,0.05);
border: 1px solid #111827;
}
.mech-key {
position: relative;
background: transparent;
border: none;
padding: 0;
width: 140px;
height: 100px;
cursor: pointer;
outline: none;
}
.key-base {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 90px;
background: #09090b;
border-radius: 12px;
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.8);
z-index: 1;
}
.key-cap {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 90px;
background: linear-gradient(180deg, #52525b, #3f3f46);
border-radius: 12px;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
/* Top highlighting and profound bottom shadow for depth */
box-shadow: inset 0 2px 2px rgba(255,255,255,0.2), inset 0 -6px 10px rgba(0,0,0,0.6), 0 10px 0 #18181b, 0 10px 10px rgba(0,0,0,0.5);
transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.1s cubic-bezier(0.4, 0, 0.2, 1);
border: 1px solid #71717a;
border-bottom: none;
}
.key-legend {
color: #e4e4e7;
font-weight: 800;
font-size: 1.25rem;
letter-spacing: 1px;
text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
/* The satisfying press interaction */
.mech-key:active .key-cap {
transform: translateY(8px);
/* Compress the shadow to mimic physical travel distance */
box-shadow: inset 0 2px 2px rgba(255,255,255,0.2), inset 0 -2px 6px rgba(0,0,0,0.6), 0 2px 0 #18181b, 0 2px 5px rgba(0,0,0,0.5);
}Nothing to show yetType HTML, CSS or JavaScript and your page appears here.
Click any element to find its code Esc
Check this code before you run it
It came from a shared link. It runs with fewer permissions, so it cannot open pop-ups, submit forms or start downloads.
0.00s / 0.00s
Nothing has animated yet. Hover, click or type in the preview and each CSS animation, transition or
element.animate() call shows up here as it plays.