🍋
Menu
CSS

View Transition

CSS View Transitions API

A browser API enabling animated transitions between DOM states or page navigations with cross-fade and morph effects.

Détail technique

The View Transition layout algorithm distributes space along a main axis and aligns items along the cross axis. Key properties: flex-grow (expansion ratio), flex-shrink (shrinking ratio), and flex-basis (initial size before distribution). The shorthand 'flex: 1' expands to 'flex: 1 1 0%'. Gap property replaces margin hacks for spacing. Flexbox excels at navigation bars, card rows, centering content, and any layout where items share a single axis.

Exemple

```css
.button {
  background: #3b82f6;
  transform: scale(1);
  transition: background 200ms ease, transform 150ms ease;
}
.button:hover {
  background: #2563eb;
  transform: scale(1.05);
}
```

Outils associés

Termes associés