CSS Button Generator

Design a button with colors, rounded corners, shadows and a hover effect, then copy the HTML and CSS.

FreeNo sign-upPrivate — runs in your browser

Presets

HTML

  
CSS

How to use the CSS Button Generator

  1. Style the buttonSet the text, colors, size, padding, corner radius and border, or start from a preset.
  2. Pick a hover effectChoose darken, lift, grow or outline. Hover over the preview to try it.
  3. Copy the codeCopy the HTML and the CSS. The CSS uses the class my-button, which you can rename.

Example

The default teal button is padding: 12px 24px; border-radius: 10px; background: #0e5e6f; with white semibold text and a soft shadow.

Choose Pill for fully rounded ends (border-radius: 40px) with a lift-up hover effect.

Frequently asked questions

How do I use the code on my site?

Paste the CSS into your stylesheet (or a <style> tag), then add class="my-button" to any link or button element. The HTML box shows an example.

Can I use it on a <button> element instead of a link?

Yes. The same class works on <button>, <a> and <input type="submit">. Use <button> for actions inside forms and <a> for links to other pages.

Why does the code include a focus style?

Keyboard users see the outline when they tab to the button, which makes your site more accessible. Keep it unless you add another visible focus style.

Will the button work on mobile?

Yes. Keep the padding generous (about 44px total height) so it is easy to tap.

Popular posts from this blog

Character Counter

Speech to Text Online

Keyboard Tester