Skip to main content
100%

SVG Animations using CSS transitions

✓ Published8🌍 Public
NNita
Last edited Mar 13, 2021
Created on Mar 8, 2021
Forked from HTML Starter

A single red rectangle inside an SVG canvas transitions to green and thickens its black stroke over three seconds when hovered. The example uses CSS transitions applied directly to SVG elements via a `rect:hover` selector, with the `transition: all 3000ms` property animating both `fill` and `stroke-width`. The rendering relies purely on inline SVG in an HTML document, demonstrating how CSS handles SVG presentation attributes without JavaScript or D3. The effect is triggered by the hover state, showing a straightforward CSS-driven animation.

AI-generated description

Inspired by w3schools

MIT Licensed

Similar vizzes