WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

CSS Buttons


Learn how to style catches utilizing CSS.


Basic Button Styling

Example

.catch {
    foundation shading: #f4df41;/* yellow */
    fringe: none;
    shading: white;
    cushioning: 18px 30px;
    content adjust: center;
    content adornment: none;
    show: inline-block;
    text dimension: 18px;
}
Attempt it Yourself »

Button Colors

Use the background-color property to change the foundation shade of a button:

Example

.button1 {background-shading: #b241f4;}/* pink */
.button2 {background-color:#4641f4;}/* Blue */
.button3 {background-shading: #41f455;}/* green */
.button4 {background-shading: #d3f441;color:black;}/* yellow */
.button5 {background-shading: #f44141;}/* red */
Attempt it Yourself »

Button Sizes

Use the font-size property to change the measure of a button:

Example

.button1 {font-measure: 10px;}
.button2 {font-estimate: 12px;}
.button3 {font-estimate: 16px;}
.button4 {font-estimate: 20px;}
.button5 {font-measure: 24px;}
Attempt it Yourself »

Rounded Buttons

Use the border-radius property to add adjusted corners to a button:

Example

.button1 {border-span: 2px;}
.button2 {border-sweep: 4px;}
.button3 {border-span: 8px;}
.button4 {border-span: 12px;}
.button5 {border-sweep: 50%;}
Attempt it Yourself »

Colored Button Borders

Use the border property to add a hued outskirt to a button:

Example

.button1 {
    foundation shading: white;
    shading: black;
    fringe: 2px strong #4CAF50;/* Green */
}
...
Attempt it Yourself »

Hoverable Buttons


Use the :hover selector to change the style of a catch when you move the mouse over it.

Tip: Use the transition-duration property to decide the speed of the "float" effect:

Example

.catch {
    - webkit-change term: 0.4s;/* Safari */
    change term: 0.4s;
}

.button:hover {
    foundation shading: #4CAF50;/* Green */
    shading: white;
}
...
Attempt it Yourself »

Shadow Buttons

Use the box-shadow property to add shadows to a button:

Example

.button1 {
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}

.button2:hover {
    box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
Attempt it Yourself »

Disabled Buttons

Use the opacity property to add straightforwardness to a catch (makes a "handicapped" look).

Tip: You can likewise include the cursor property with an estimation of "not-permitted", which will show a "no stopping sign" when you mouse over the button:

Example

.impaired {
    mistiness: 0.6;
    cursor: not-allowed;
}
Attempt it Yourself »

Button Width


By default, the measure of the catch is controlled by its content substance (as wide as its content). Utilize the width property to change the width of a button:

Tip: Use pixels in the event that you need to set a settled width and use percent for responsive catches (for example half of its parent element).

- - >

Example

.button1 {width: 250px;}
.button2 {width: 50%;}
.button3 {width: 100%;}
Attempt it Yourself »

Button Groups


Remove edges and include float:left to each catch to make a catch group:

Example

.catch {
    drift: left;
}
Attempt it Yourself »

Bordered Button Groups


Use the border property to make a circumscribed catch group:

Example

.catch {
    coast: left;
    fringe: 1px strong green
}
Attempt it Yourself »

Animated Buttons

Example

Add a bolt on hover:

Attempt it Yourself »

Example

Add a "swell" impact on click:

Attempt it Yourself »

Example

Add a "squeezed" impact on click:

Attempt it Yourself »