Robin Guide

Lesson: CSS Transitions

Bring your designs to life with smooth animations!

๐ŸŽฌ What are CSS Transitions?

Transitions let you smoothly change CSS properties over time, like colors, positions, or sizes.

โš™๏ธ Basic Syntax

element {
  transition: [property] [duration] [timing-function] [delay];
}

Example:

.box {
  transition: all 0.3s ease-in-out;
}

๐Ÿงช Example: Hover Color Change

.button {
  background: blue;
  color: white;
  padding: 10px 20px;
  transition: background 0.3s;
}
.button:hover {
  background: darkblue;
}

๐Ÿงช Example: Scale on Hover

.card {
  transition: transform 0.3s;
}
.card:hover {
  transform: scale(1.05);
}

๐Ÿงช Example: Slide Up Caption

.image-box {
  position: relative;
  overflow: hidden;
}
.caption {
  position: absolute;
  bottom: -50px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px;
  transition: bottom 0.4s ease;
}
.image-box:hover .caption {
  bottom: 0;
}

๐Ÿ“Œ Tips for Better Transitions

๐Ÿš€ Try It Yourself!

Open Transitions Playground
PREVIOUS LESSON :

Responsive Design with Media Queries

NEXT LESSON :

Pseudo-Selectors