Button Hover Effect
Part of the CSS Mastery section of Coddy's HTML journey — lesson 41 of 43.
Challenge
EasyA button is already in the HTML. Your goal is to make it scale up slightly when the user hovers over it. In the CSS, style the .cta-button so that:
- It has a smooth transition
transition: transform 0.3s ease;. - On hover, it slightly increases in size using
transform: scale(1.05).
Try it yourself
<html>
<head>
<title>Button Hover Effect</title>
<style>
/* Add your styles here */
.cta-button {
background-color: #6a1b9a;
color: white;
padding: 12px 24px;
border: none;
border-radius: 8px;
font-size: 1rem;
}
</style>
</head>
<body>
<button class="cta-button">Click Me</button>
</body>
</html>
All lessons in CSS Mastery
1Selector Mastery – Combination
IntroductionDescendant SelectorChild SelectorAdjacent Sibling SelectorGeneral Sibling SelectorRecap Challenge3Structural pseudo-classes
Structural pseudo-classesTargeting the First ChildTargeting the Last ChildPattern Power: Using nth-childRecap Challenge6Landing Page
Style the Header SectionStyle the buttonSection Layout Card Layout Add Finishing Touches9Final Challenges
Highlight Active MenuZebra Table RowsButton Hover EffectGrid Card LayoutBlurred Hero Image