Terminal CSS button
Old-school green terminal command. Hover, click and tab to it to see every state.
CSS
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: .5em;
padding: 8px 18px;
font-family: 'VT323', monospace;
font-size: 24px;
font-weight: 400;
line-height: 1.2;
color: #33ff66;
background: #050805;
border: 2px solid #33ff66;
border-radius: 0px;
box-shadow: 0 0 12px 0 rgba(51, 255, 102, .34999999999999997779553950749686919152736663818359375);
text-shadow: 0 0 6px rgba(51, 255, 102, .8000000000000000444089209850062616169452667236328125);
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:hover {
filter: brightness(1.25);
}
.btn:active {
transform: scale(0.979999999999999982236431605997495353221893310546875);
transition-duration: 40ms;
}
.btn:focus-visible {
outline: 3px solid #050805;
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.btn {
transition: none;
animation: none;
}
}
HTML
<button class="btn" type="button">
run --start
</button>
How this button is built
- Background: a solid #050805 fill.
- Type: VT323, weight 400, 24px, in #33ff66.
- Shape: square corners with 8px × 18px padding, plus a 2px solid border.
- Depth: a coloured glow and a text shadow.
- Interaction: on hover it brightens slightly, and 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 VT323 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.