Skip to main content
Public

Share visualization

Loading preview…

Fork of Shapes and Colors with SVG and CSS

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Fork of Shapes and Colors with SVG and CSS

0
Nnpk2001
Last edited Jan 19, 2023
Created on Jan 19, 2023

This example demonstrates how to build a simple face using SVG shapes—a yellow circle for the head and two smaller black circles for the eyes—positioned dynamically within an SVG canvas. The code selects the SVG element with d3’s `select` method, parses its width and height attributes, and appends the circles using method chaining with `attr` calls. Styling is applied via CSS classes and inline attributes, while the D3 v5 library is loaded from a CDN to handle the DOM manipulation.

AI-generated description

An example including some commonly used features of SVG.

Comments

Sign in to join the discussion.

MIT Licensed