Simply Styled Buttons

CSS Button Styling Examples: Part One

Eight simple CSS button styling examples. Straightforward design - no animations, no fading.

Back to Code Examples

Calls to action and links with emphasis, buttons are an integral part of the navigation of any website. They guide navigation, grab attention, and reinforce your site’s branding. A good button should stand out just enough to say, "Click me," without shouting over the rest of your design.

Often, a simple design is best: a solid color with contrasting text, or a white button with colored text and border. Rounded corners give a softer look; sharp corners feel bold and direct. Want to push the look a bit further? Try slanting the button for visual interest - just be ready for a few extra styling challenges.

Then there's the hover state to consider - especially on desktop. A button should look interactive when hovered over, with styling that clearly changes. That might mean darkening, lightening, or shifting the background color entirely. A white button with dark text might invert to dark with white text. The effect can be subtle or bold, depending on the look you're going for. The important thing is that the shift is noticeable.


If you're looking to add a little polish, consider a subtle transition between the default and hover states. When you're ready to level up, check out this post for examples of button transitions and animations.

Below are eight examples of how to style simple buttons for your website. For this demonstration, each button is a <div> wrapped in an <a> tag, rather than a <button> or <input> element. This setup offers more flexibility and ease when styling. Anchor (<a>) tags alone can be temperamental with padding, while <button> elements don't naturally navigate anywhere—you'd need JavaScript or an anchor wrapper to make them clickable. As for <input> buttons, they're limited to forms and come with their own quirky styling behaviors.

That’s why the base structure for the buttons in this post looks like this:

<a href="#"><div>Click here!</div></a>


On to the examples...

Basic Rectangle - Color Change on Hover

This classic style works well on any site. I've used green to gold here, but you can match the base and hover colors to your own branding.

Padding, font, and width rules help keep all the button examples uniform - but feel free to adjust them. Remove the width for varied sizes, or reduce padding for a slimmer look. I recommend keeping the text-align rule to avoid off-center text.

HTML:

Copy to clipboard
<a href='#'><div id='button-example-927'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-927 {

color: #fffff7; background-color: #364D30; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center;

}

#button-example-927:hover {

background-color: #D1B589;

}

Rounded Rectangle - Color Change on Hover

This button is the rounded-corner version of the classic rectangular style. The choice between sharp or rounded corners is purely aesthetic - both have trended in and out of fashion. While sharp edges may be having a moment, the softer feel of rounded corners can better suit certain designs.

You don’t need a border to use border-radius; the rule still applies without one.

HTML:

Copy to clipboard
<a href='#'><div id='button-example-935'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-935 {

color: #fffff7; background-color: #652F2A; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center; border-radius: 15px;

}

#button-example-935:hover {

background-color: #D1B589;

}

Basic Rectangle - Outline to Color on Hover

Outlined buttons are a clean, flexible choice - especially useful on saturated or textured backgrounds. Instead of using a solid fill, these buttons rely on a visible border and contrasting text color to stand out without overwhelming the design.

A common approach is to start with a white background and apply a contrasting colored border and matching text. On hover, the background and text colors swap, creating a high-contrast, interactive effect. This technique keeps the button lightweight while still clearly signaling interactivity.

HTML:

Copy to clipboard
<a href='#'><div id='button-example-939'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-939 {

color: #364D30; border: 3px solid #364D30; background-color: #fff; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center;

}

#button-example-939:hover {

border: 3px solid #364D30; background-color: #364D30; color: #fff;

}

Rounded Rectangle - Outline to Color on Hover

This is the rounded-corner variation of the classic outlined button - same styling logic, softer silhouette. By adding a border-radius, you get a more approachable look. The hover effect remains the same: background and text colors swap for contrast and interactivity.

In this example, the border radius is set to 15 pixels. Lower values (like 5px) create a subtler curve, while higher values push the button toward a pill-shaped appearance.

HTML:

Copy to clipboard
<a href='#'><div id='button-example-940'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-940 {

color: #652F2A; border: 3px solid #652F2A; background-color: #fff; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center; border-radius: 15px;

}

#button-example-940:hover {

border: 3px solid #652F2A; background-color: #652F2A; color: #fff;

}

Basic Rectangle - Darken on Hover

This solid-color button darkens on hover. No secondary background color required. The beauty of the approach is its flexibility—you don’t need to worry about choosing a specific hover color, and it works with nearly any base color that isn’t already very dark.

Background images are always applied over the background color. This style takes advantage of that property by putting a linear gradient in as the background image, and then setting that gradient to be a single transparent color - in this case, black with only 20% opacity. Increase that 0.2 to make it darker, and decrease in order to make it a lighter effect.

HTML:

Copy to clipboard
<a href='#'><div id='button-example-942'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-942 {

color: #fffff7; background-color: #D0A7A2; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center;

}

#button-example-942:hover {

background-image: linear-gradient(rgba(0, 0, 0, 0.2));

}

Rounded Rectangle - Lighten on Hover

This variation lightens the button on hover - a simple alternative to the darkening method. While you could achieve the effect with a gradient overlay, there's an even easier option if the button sits on a light background: reduce the button’s overall opacity on hover.

In this example, the button drops to 80% opacity. Raise the value for a subtler effect, or lower it for a more noticeable shift. If you did need to to lighten a button on a dark background, then you could also use the following on hover instead of the opacity shift:

background-image: linear-gradient(rgba(255, 255, 255, 0.2));

HTML:

Copy to clipboard
<a href='#'><div id='button-example-943'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-943 {

color: #fffff7; border: 1px solid #652F2A; background-color: #652F2A; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center; border-radius: 15px;

}

#button-example-943:hover {

opacity: 0.8;

}

Slanted Button - Color Change on Hover

Slanted buttons are quirky, eye-catching, and suggest motion. While not suited to every site, they can add a distinctive flair that helps your design stand out.

The slant effect is created using ::before and ::after pseudo-elements, skewed with transform: skewX(). These elements sit behind the main button using z-index: -1, while the button itself is positioned relatively and given a higher z-index: 1 to stay on top.

Because of the slant, these buttons can be tricky to align vertically with other elements. A little extra margin or padding usually solves it.

For this example, I did a simple background color change on hover. Fortunately, we don't have to change the background color of the pseudo elements as well - that is automatically taken care of by their background: inherit rules.

To adjust the angle, tweak the skewX value. If the slant gets clipped, you may also need to adjust the left and right values of the pseudo-elements.

HTML:

Copy to clipboard
<a href='#'><div id='button-example-1599'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-1599 {

position: relative; z-index: 1; color: #fffff7; background-color: #D0A7A2; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center;

}

#button-example-1599:hover {

background-color: #364D30;

}

#button-example-1599:before {

content: ""; z-index: -1; position: absolute; left: -5%; top: 0; height: 100%; width: 100%; background-color: inherit; transform: skewX(-15deg);

}

#button-example-1599:after {

content: ""; z-index: -1; position: absolute; right: -5%; top: 0; height: 100%; width: 100%; background-color: inherit; transform: skewX(-15deg);

}

Slanted Button - Outline to Color on Hover

Slanted buttons add motion and visual interest, making them a bold stylistic choice. The slant is achieved with ::before and ::after pseudo-elements skewed using transform: skewX(). These elements sit behind the main button using z-index: -1, while the main element stays on top at z-index: 1. By using background: inherit, the background of the pseudo-elements updates automatically when the button’s background changes.

You may need to adjust margins or padding to account for the visual offset the skew introduces. To fine-tune the slant, change the skewX angle, and tweak the left and right values if clipping occurs.

Creating a clean outline on a slanted button is trickier than it looks. Initially, I added the border to the base div, but it didn’t align properly with the skewed pseudo-elements, resulting in a jarring mismatch. The solution: apply the border only to the ::before and ::after elements. To avoid a visible overlap where they meet, the left border is removed from the ::after element. This approach keeps the outline seamless, even though it’s made from multiple layers.

HTML:

Copy to clipboard
<a href='#'><div id='button-example-1602'>Click here!</div></a>

CSS:

Copy to clipboard

#button-example-1602 {

position: relative; z-index: 1; color: #652F2A; background-color: #fff; padding: 20px 40px; font-size: 18px; font-weight: 600; width: 200px; text-align: center;

}

#button-example-1602:hover {

background-color: #652F2A; color: #fff;

}

#button-example-1602:before {

content: ""; z-index: -1; position: absolute; left: -5%; top: 0; height: 100%; width: 100%; background-color: inherit; border: 2px solid #652F2A; transform: skewX(-15deg);

}

#button-example-1602:after {

content: ""; z-index: -1; position: absolute; right: -5%; top: 0; height: 100%; width: 100%; background-color: inherit; border: 2px solid #652F2A; border-left: none; transform: skewX(-15deg);

}

Pumpkins n' Pies

For gluten-free baking enthusiasts and garden lovers: discover delicious, from-scratch recipes featuring sourdough, whole foods, and most importantly – pie! Explore gardening tips from central Illinois, along with a byte of code for fellow developers.
 © 2025 Abhishek & Miriam Chaturvedi