Skip to main content
100%

The first commented line is your dabblet’s title

✓ Published0🌍 Public
Mmbostock
Last edited Jan 1, 2012
Created on Jan 1, 2012

A full-width SVG rectangle is dynamically recolored based on its initial CSS background. The example demonstrates a minimal D3.js interaction: a single `d3.select` call targets the `rect` element and applies a solid red fill, overriding the page’s gradient styling. The HTML contains the SVG markup, while the CSS sets a pink-to-yellow linear gradient as the page background. The script loads D3 from a remote URL and uses the `style` method to mutate the SVG shape’s presentation, showing how D3 can directly manipulate existing DOM nodes.

AI-generated description

Similar vizzes