Skip to main content
Public

Share visualization

Loading preview…

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

Shapes and Colors with SVG and CSS

0
Ssheikh357
Last edited Sep 18, 2023
Created on Sep 18, 2023

This example demonstrates how SVG shapes can be styled and organized with CSS and inline attributes. It shows circles, rectangles, lines, and a path, with elements grouped using `<g>` tags and transformed via translation and scaling. The code uses the SVG API directly in an HTML file, with a linked stylesheet that applies stroke and fill properties to the `.lines` class and its path. Color is specified through CSS classes, hexadecimal values, and named colors, while the rendering is done entirely in static SVG without JavaScript libraries or data.

AI-generated description

An example including some commonly used features of SVG.

Comments

Sign in to join the discussion.

MIT Licensed