</> Code Corner

CSS · CSS Advanced · Lesson 53

CSS Buttons

Style button colors, sizes, borders and hover effects.

Style buttons with padding, colors, rounded corners, shadows and hover effects.

Example

<style>
.btn { border: none; color: white; padding: 12px 26px; font-size: 16px; border-radius: 8px; cursor: pointer; margin: 4px; transition: .2s; }
.green { background: #04AA6D; }
.blue { background: #008CBA; }
.outline { background: white; color: #04AA6D; border: 2px solid #04AA6D; }
.btn:hover { box-shadow: 0 8px 16px rgba(0,0,0,.2); transform: translateY(-2px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
</style>
<button class="btn green">Green</button>
<button class="btn blue">Blue</button>
<button class="btn outline">Outline</button>
<button class="btn green" disabled>Disabled</button>

Keep reading “CSS Buttons”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋