<main>
  <h1>Origins Demo 2: Sate vs Type</h1>
  <button>default</button>
  <button class="danger">danger</button>
  <button disabled>disabled</button>
  <button class="danger" disabled>danger disabled</button>
</main>
button {
  --btn-default: rebeccapurple;
  background: var(--btn-state, var(--btn-type, var(--btn-default)));
  color: white;
}

:disabled {
  --btn-state: dimgray;
}

.danger {
  --btn-type: maroon;
}


/* layout */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: avenir, roboto, helvetica, sans-serif;
}

body {
  display: grid;
  font-size: calc(1em + 0.5vw);
  min-height: 100vh;
  padding: 1em;
  place-content: safe center;
}

h1, h2, h3 {
  margin-top: 0;
}

button {
  border: none;
  border-radius: 0.25em;
  padding: 0.25em 1.5em;
  font: inherit;
  cursor: pointer;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.