How to Style a Button in CSS

Use CSS button styling when you want a button to match your brand, improve click clarity, and feel easier to interact with. Good button styles combine spacing, contrast, borders, and hover feedback.

What you’ll build or solve

You’ll learn how to style a button in CSS using the most important visual properties. You’ll also know how to make buttons feel clickable and consistent across your UI.

When this approach works best

This approach is the right choice when the default browser button looks out of place in your design.

Common real-world scenarios include:

  • CTA buttons
  • Form submit buttons
  • Pricing page actions
  • Dashboard controls
  • Navigation actions

This is a bad idea when the button style removes all visual cues and users can no longer tell it is clickable.

Prerequisites

You only need:

  • A basic HTML button
  • A text editor
  • Basic HTML and CSS knowledge

Step-by-step instructions

Step 1: Style the core button properties

Start with the most important visual layers: padding, background, text color, border, and radius.

<button class="cta">USA pricing</button>

<style>
  .cta {
    padding: 12px 24px;
    background: #0057ff;
    color: white;
    border: none;
    border-radius: 8px;
  }
</style>

Then add hover feedback so the button reacts to interaction.

<style>
  .cta:hover {
    background: #003bb3;
  }
</style>

What to look for:

  • Padding improves click comfort
  • Strong contrast improves readability
  • Border radius softens the shape
  • border: none removes browser defaults
  • Hover feedback improves click confidence

Examples you can copy

CTA button

<button class="cta">Start in USA</button>

<style>
  .cta {
    padding: 14px 28px;
    background: #0070f3;
    color: white;
    border: none;
    border-radius: 10px;
  }
</style>

Outline button

<button class="secondary">France docs</button>

<style>
  .secondary {
    padding: 10px 20px;
    background: white;
    color: #111;
    border: 1px solid #111;
    border-radius: 8px;
  }
</style>

Rounded pill button

<button class="pill">UK pricing</button>

<style>
  .pill {
    padding: 12px 24px;
    border-radius: 999px;
  }
</style>

Common mistakes and how to fix them

Mistake 1: Removing all button cues

What the reader might do:

button {
  background: transparent;
  border: none;
}

Why it breaks: the button may look like plain text.

Corrected approach:

button {
  background: #0057ff;
  color: white;
  padding: 12px 24px;
}

Mistake 2: Too little padding

What the reader might do:

button {
  padding: 2px 4px;
}

Why it breaks: the click target becomes too small and hard to tap.

Corrected approach:

button {
  padding: 12px 24px;
}

Mistake 3: No hover or focus feedback

What the reader might do:

button {
  background: #0057ff;
}

Why it breaks: users get less interaction feedback.

Corrected approach:

button:hover {
  background: #003bb3;
}

Troubleshooting

If the button still looks default, confirm the class selector matches the HTML button.

If the text is hard to read, increase color contrast.

If the button feels cramped, increase padding.

If it does not feel interactive, add hover and focus states.

Quick recap

  • Style padding, background, color, border, and radius
  • Use strong contrast
  • Add enough padding for easy clicks
  • Add hover feedback
  • Keep the button clearly clickable