Skip to content
OddsockLocal
Local
Base color#427f9c
Corner radius (px)8
Button stylesolid
Base color#427f9c
Corner radius (px)8
Button stylesolid
ReadyRuns in this browser. Nothing is uploaded.

How to use

  1. Pick the base color and the corner radius.
  2. Choose solid, outline, soft, or hard shadow.
  3. Copy both rules, including the hover.
  4. Add a :focus-visible outline in your stylesheet. The snippet does not include one.

What is CSS button?

A button color chosen from a brand swatch often fails the moment text is placed on it. This page writes a .button rule and a .button:hover rule from a base color, a corner radius, and a style: solid, outline, soft, or hard shadow. Text color is chosen by measuring the base against black and against white, so #427f9c, the opening teal, gets black text. The solid rule is background #427f9c, a 2px border in the same color, 8px corners, and padding 0.625em 1em.

Read more

Hover darkens the base and flips the label to white or black based on that darker color. On the opening teal the hover fill is #35667d with white text. Outline keeps the fill transparent and uses the base as the border and the label. Soft tints the fill toward white. Hard shadow adds a 4px offset shadow with no blur, the blunt kind, and still includes the hover.

The class names are .button and .button:hover. Rename them if your stylesheet already uses .button for something else. The page does not write focus rings. Add a visible :focus-visible outline in your own CSS, because a hover change is not a keyboard style.

Use cases

  • A marketing page needs a solid button that stays readable on a teal brand color.
  • A docs site wants an outline button that does not invent a second palette.
  • A poster layout tries the hard shadow style for a sticker-like control.
  • A designer checks the hover color before coding the state by hand.
  • A prototype uses the soft style so the button sits back from the primary action.

A solid teal button

Base #427f9c, corner radius 8, style solid.

.button { background: #427f9c; color: #000000; border: 2px solid #427f9c; border-radius: 8px; padding: 0.625em 1em; cursor: pointer; } .button:hover { background: #35667d; color: white; }

Why use Oddsock

Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.

Related tools

Using this tool

Black on #427f9c beats white on the same fill. The page picks the pair with the higher contrast, then rechecks on the hover color.