<button>I am a button</button>
<button class="secondary">I am a secondary button</button>
<button class="outline">I am an outline button</button>
<button class="secondary outline">I am am outline secondary button</button>
<button class="orange">I am an orange button</button>
<button class="orange outline">I am an outline orange button</button>
/* default buttons layer */
@layer buttons {
  button {
    --_color: var(--color, black);
    background: var(--_color);
    border: 2px solid var(--_color);
    color: white;

  button.secondary {
    --color: deeppink;
    --hoverColor: purple;

/* Non layered styles come last */
button.outline {
  background: transparent;
  color: var(--_color);

button:is(:hover, :focus) {
  --color: var(--hoverColor, DarkCyan);

/* then in another file or lower in the file, you can add them to the layer */
@layer buttons {
  button.orange {
    --color: orange;
    --hoverColor: darkorange;

/* presentation styles */

button {
   padding: 0.813rem 1.25rem;
  border-radius: 0.313rem;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;

@import url("https://fonts.googleapis.com/css2?family=Inter&display=swap");

div {
  margin-block: 25px;

*::after {
  box-sizing: border-box;

body {
  display: flex;
  background: rgb(247, 249, 251);
  flex-direction: column;
  gap: 30px;
  margin: 0;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  font-size: 1.1rem;
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.