CSS buttons
Design buttons (solid, outline, ghost, gradient) with all their states and copy the HTML and CSS.
Processed in your browser · Check it yourself Nothing sentData sent: 0 · To other domains: 0Analytics: not present · Ads: not present
Normal
:hover
:active
:focus-visible
:disabled
<button class="btn" type="button">Button</button>
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
padding: 10px 20px;
border-radius: 8px;
border: 2px solid transparent;
font-size: 16px;
font-weight: 600;
line-height: 1.2;
font-family: inherit;
color: #ffffff;
transition: background-color 150ms, color 150ms, box-shadow 150ms, transform 150ms, filter 150ms;
background-color: #4f46e5;
border-color: #4f46e5;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
}
.btn:hover {
background-color: #2d22e0;
border-color: #2d22e0;
}
.btn:active {
transform: translateY(1px);
background-color: #271dcd;
border-color: #271dcd;
}
.btn:focus-visible {
outline: 3px solid rgba(79, 70, 229, 0.45);
outline-offset: 2px;
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}