Win95 CSS button
Grey 90s desktop button with bevelled edges. Hover, click and tab to it to see every state.
CSS
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: .5em;
padding: 8px 36px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 1.2;
color: #000000;
background: #c0c0c0;
border: 0;
border-radius: 0px;
box-shadow: inset -1px -1px 0 0 #0a0a0a, inset 1px 1px 0 0 #ffffff, inset -2px -2px 0 0 #808080, inset 2px 2px 0 0 #dfdfdf;
cursor: pointer;
text-decoration: none;
white-space: nowrap;
-webkit-tap-highlight-color: transparent;
transition: transform 80ms linear, box-shadow 80ms linear, filter 80ms linear;
}
.btn:active {
transform: none;
transition-duration: 40ms;
}
.btn:focus-visible {
outline: 3px solid #c0c0c0;
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.btn {
transition: none;
animation: none;
}
}
HTML
<button class="btn" type="button">
OK
</button>
How this button is built
- Background: a solid #c0c0c0 fill.
- Type: Helvetica / Arial, weight 400, 14px, in #000000.
- Shape: square corners with 8px × 36px padding.
- Depth: inset shadows for a highlighted, sculpted edge.
- Interaction: it squishes slightly when clicked, with 80ms transitions.
- Accessibility: a visible
:focus-visiblering for keyboard users, and all motion turns off underprefers-reduced-motion.
How to use it
- Copy the CSS into your stylesheet. The
@importline loads the Helvetica / Arial font from Google Fonts. Move it to the top of your file, or drop it if you already load the font. - Paste the HTML where you want the button. It works on
<button>,<a>and<input type="submit">. - Change the label, or rename the
.btnclass if it clashes with your framework. Want a different colour or size? Open it in the editor, change it visually, and copy the new code.