CSS Buttons


Discover how to make buttons look nice with CSS.


Basic Button Styling


Button Colors

You can alter the background color of a button by using the "background-color" property.


Button Sizes

You can adjust the size of a button's text using the "font-size" property in your HTML code like this:

You can adjust the space around a button using the "padding" property.


Rounded Buttons

You can make a button's corners look round by using the "border-radius" property.


Colored Button Borders

You can use the "border" property to give a button a colored border.


Hoverable Buttons


You can make a button look different when you hover your mouse over it by using the ":hover" selector.

Tip: You can control how fast the 'hover' effect occurs by adjusting the 'transition-duration' property.


Shadow Buttons

You can make a button look like it has a shadow by using the "box-shadow" property in HTML. Here's how you can do it:


Disabled Buttons

You can make a button look faded or disabled by using the "opacity" property.

Hint: You can also include the 'cursor' property with the 'not-allowed' value to show a 'no parking sign' when you hover over the button:


Button Width


The button's size is usually based on the text it contains. It will be as wide as the text. To make the button wider, you can use the "width" property.


Button Groups

To create a button group, you should remove any extra space around the buttons and make them float to the left. You can do this by adding the CSS style 'float: left' to each button.


Bordered Button Group


You can make a button group with borders by using the border property.

Vertical Button Group


To make buttons stack vertically instead of horizontally, use display:block instead of float:left.


Button on Image

Eiffle

Animated Buttons