liveBook · Manning

Transition

As explained in Web Design Playground, Second Edition

The CSS transition property specifies animated changes between values of other CSS properties.

A CSS transition animates a change in a property’s value. In a before-and-after portfolio image, the “after” picture starts invisible and appears when you hover over it. The transition makes that appearance gradual rather than instant. section 20.5

.image-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 200px;
  height: 156px;
  z-index: 1;
  opacity: 0;
  transition: opacity 1.5s ease;
}
.image-overlay:hover {
  opacity: 1;
}

The overlay starts at `opacity: 0`. Hovering changes it to `opacity: 1`, while `transition: opacity 1.5s ease` animates that change over 1.5 seconds. section 20.5

How Web Design Playground, Second Edition covers it

How deep it goes
Shows a working opacity transition and hover rule without exploring other transition properties or internals.
Examples
Uses a portfolio image overlay that changes from invisible to visible on hover.
What it assumes
Builds on CSS selectors, opacity, and positioned images, with the working rules supplied.
What you can do after
Build it from scratch: add an opacity transition to a hover-revealed image overlay.
How it connects
Connects CSS transitions to opacity, hover states, and positioned image overlays.

Also explained in

Compare how 5 books explain transition →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground, Second Edition. The section links point to the parts of the book it draws on.