CSS Outline Button Set
Outlined buttons in primary, neutral and danger colors that fill solid on hover, themed with one variable.
<button class="btn-outline">Save</button>
<button class="btn-outline btn-outline-neutral">Cancel</button>
<button class="btn-outline btn-outline-danger">Delete</button>
.btn-outline {
--btn-color: #2563eb;
padding: 12px 24px;
border: 2px solid var(--btn-color);
border-radius: 10px;
background: transparent;
color: var(--btn-color);
font: 600 15px/1 system-ui, sans-serif;
cursor: pointer;
transition: background-color 0.2s ease, color 0.2s ease;
}
.btn-outline:hover {
background: var(--btn-color);
color: #fff;
}
.btn-outline:focus-visible {
outline: 3px solid var(--btn-color);
outline-offset: 3px;
}
.btn-outline-neutral {
--btn-color: #3f3f46;
}
.btn-outline-danger {
--btn-color: #dc2626;
}
About this CSS Outline Button Set
This CSS Outline Button Set is 29 lines of pure CSS (0.5 KB) with no JavaScript and no dependencies. It uses transitions, keyboard focus styles and custom properties. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
Change these custom properties to restyle the outline button set without touching the rest of the CSS:
| Property | Default |
|---|---|
--btn-color | #2563eb |
How to use this outline button set
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.btn-outlineclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.