Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

SVG Examples

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:

  1. Google Chrome: Full SVG support, from version 1.0.
  2. Mozilla Firefox: Full SVG support, from version 1.5.
  3. Microsoft Edge: Full SVG support.
  4. Safari: Full SVG support, from version 3.1.
  5. Opera: Full SVG support, from version 9.0.

Mobile browser support:


SVG Examples

SVG Basic Shapes

A Circle

Rectangle

Opaque Rectangle

A Rectangle, Opacity 2

A Rectangle with Rounded Corners

An Ellipse

Three Stacked Ellipses

Two Ellipses

A Line

Triangle

Quadrilateral

A Star

Another Star

Polyline

Another Polyline

Path

Quadratic Bezier Curve

Writing Text

Rotated Text

Text on a Path

Several Lines of Text

Text Link

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

feGaussianBlur - Blur Effect

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

A feBlend Filter

A feColorMatrix Filter

A feComponentTransfer Filter

feOffset, feFlood, feComposite, feMerge, and feMergeNode

A feMorphology Filter

Filter 1

Filter 2

Filter 3

Filter 4

Filter 5

Filter 6

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

Text that moves, rotates, and scales along a motion path

Text that moves, rotates, and scales along a motion path + a rectangle that gradually enlarges and changes color