Skip to main content
100%

Shapes with SVG and CSS

✓ Published1🌍 Public
MMusikdude
Last edited Feb 14, 2020
Created on Feb 13, 2020

This example demonstrates how SVG shapes can be styled with CSS, setting the entire visualization’s background to red via a style property. The code uses D3 v5’s `select` function to target the `<svg>` element and apply the background color directly. The visualization consists of a bare 960-by-500 pixel SVG canvas embedded in an HTML page, with styling separated into an external stylesheet. It highlights the simplicity of combining D3’s selection API with CSS-based visual customization.

AI-generated description

A bare minimum HTML page.

See also React Starter.

MIT Licensed

Similar vizzes