The Journey of #100DaysOfCode (@Nisrine_bg)

Day 23: Implementing CSS Transitions


CSS transitions allow you to smoothly change the style of an element from one state to another over a specified duration. This creates a more interactive and visually appealing experience.

Example: Button Hover Effect

Here’s a short example of creating a smooth color and size transition on a button when hovered over.

CSS Transition Example
<style>
    .button {
        background-color: #0000ff ;
        color: white;
        padding: 10px 20px;
        border: none;
        border-radius: 5px;
        font-size: 16px;
        cursor: pointer;
        transition: background-color 0.3s ease, transform 0.3s ease;
    }

    .button:hover {
        background-color: #2980b9;
        transform: scale(1.1);
    }
</style>
Hover Me!
3 Likes