← All tools

CSS Button Generator

Style a button and test its normal, hover and keyboard-focus states.

css-button-generatorLOCAL WORKSPACE

Enabling local controls…

Tool settings

Settings stay on this page. Reloading restores the defaults.

Feature reference checked 2026-11-21 · ZeroServer

Live preview and export

CSS

.custom-button {
  background: #4f46e5;
  color: #ffffff;
  padding: 11px 22px;
  border: 0px solid #000000;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  max-inline-size: 100%;
  overflow-wrap: anywhere;
}

.custom-button:hover, .custom-button:focus-visible {
  background: #4338ca;
}

.custom-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -4px;
}

@media (prefers-reduced-motion: no-preference) {
  .custom-button {
    transition: background-color 0.2s ease;
  }
}

HTML

<button class="custom-button" type="button">Click me</button>

How to use this tool

Choose a preset or edit the controls. Compare the live preview, then copy or download the styles and any available markup.

When not to use it

Verify contrast, placement and browser behavior in the component that will use the exported styles.