
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How to draw a polyline in HTML5 SVG?
SVG stands for Scalable Vector Graphics and is a language for describing 2D-graphics and graphical applications in XML and the XML is then rendered by an SVG viewer. Most of the web browsers can display SVG just like they can display PNG, GIF, and JPG.
To draw a polygon in HTML SVG, use the SVG <polyline> element. The <polyline> element is to create a shape that consists of straight lines. The points attribute is the x and y coordinates for each corner.
Example
You can try to run the following code to learn how to draw a polyline in HTML5 SVG:
<!DOCTYPE html> <html> <head> <style> #svgelem { position: relative; left: 20%; -webkit-transform: translateX(-20%); -ms-transform: translateX(-20%); transform: translateX(-20%); } </style> <title>HTML5 SVG Polyline</title> </head> <body> <h2>HTML5 SVG Polyline</h2> <svg id="svgelem" width="300" height="300" xmlns="http://www.w3.org/2000/svg"> <polyline points="0,0 0,20 20,20 20,40 40,40 40,60" fill="red" /> </svg> </body> </html>
Output
- Related Articles
- How to draw a rectangle in HTML5 SVG?
- How to draw a polygon in HTML5 SVG?
- How to draw a star in HTML5 SVG?
- How to draw SVG Logo in HTML5?
- How to draw shapes using SVG in HTML5?
- How to draw sine waves with HTML5 SVG?
- How to draw grid using HTML5 and canvas or SVG?
- How to draw an SVG file on an HTML5 canvas?
- How to use SVG images in HTML5?
- How to draw a hollow circle in SVG?
- How to work with Scalable Vector Graphics (SVG) in HTML5?
- How to draw a circle using an SVG tag in html?
- How to draw a dotted line with Polyline using FabricJS?
- How to draw a hexagon with Polyline class using FabricJS?
- How to draw a square with Polyline class using FabricJS?

Advertisements