SVG Examples
Online example
The following example embeds SVG code directly into HTML code.
Almost all modern browsers support the SVG (Scalable Vector Graphics) format.
The following is the support status of some major browsers:
- Google Chrome: Full SVG support, from version 1.0.
- Mozilla Firefox: Full SVG support, from version 1.5.
- Microsoft Edge: Full SVG support.
- Safari: Full SVG support, from version 3.1.
- Opera: Full SVG support, from version 9.0.
Mobile browser support:
- iOS Safari: Full SVG support.
- Android Browser: Full SVG support.
- Chrome for Android: Full SVG support.
SVG Examples
SVG Basic Shapes
A Rectangle with Rounded Corners
Define the color of a line, text, or outline (stroke)
Define the width of a line, text, or outline (stroke-width)
The stroke-linecap attribute defines the endings of different types of open paths:
Define dashed lines (stroke-dasharray)
SVG Filters
feOffset - Offset a rectangle, then blend the top of the offset image
feOffset - Blur the offset image
feOffset - Make the shadow black
feOffset - Paint a color onto the shadow
feOffset, feFlood, feComposite, feMerge, and feMergeNode
SVG Gradients
Horizontal linear gradient ellipse from yellow to red
Vertical linear gradient ellipse from yellow to red
Horizontal linear gradient from yellow to red with text inside an ellipse
Radial gradient ellipse from white to blue
Another radial gradient ellipse from white to blue
SVG Miscellaneous
A rectangle that repeatedly fades out over 5 seconds
The rectangle grows larger and changes color
Three rectangles that change color
Text moving along a motion path