🌍 Public
Viewing a saved revision (read-only)
54017f9e8f7042188f46f933ec21d96e
Centered text
This example shows how to create a static SVG graphic with a single, perfectly centered text label against a teal background. The code uses D3’s `select` method to append an SVG element to the body and sets its dimensions via `viewBox`. It then appends a `text` element, positions it at the midpoint of the SVG’s width and height, and applies the `text-anchor` and `dominant-baseline` attributes to achieve both horizontal and vertical centering. The text is styled with a 34px font size.
AI-generated descriptionTrying to learn how this thing works.
ISC Licensed