HTML Academy
Challenge: Arithmetic Operators
An Introduction to SVG14/15
Back to the list of tasks
  • 1. Hello, SVG!
  • 2. Drawing a Rectangle
  • 3. Rectangle Coordinates
  • 4. Corner Rounding
  • 5. Challenge: Fixing the TV
  • 6. Polygons
  • 7. Challenge: Pyramids
  • 8. Drawing a Circle
  • 9. Challenge: Target
  • 10. Drawing an Ellipse
  • 11. Challenge: Surprised Smiley
  • 12. Drawing Lines
  • 13. Challenge: Arithmetic Operators
  • 14. Drawing Polylines
  • 15. Challenge: Hot-Air Balloons
Challenge: Hot-Air Balloons
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Drawing Polylines

You can draw polylines using the polyline tag. The coordinates of points on the line can be set using the points attribute, just like they can for the polygon.

Code example:

<polyline points="10,135 100,10 55,135 10,10 105,135"/>

Result:

The difference between a polygon and a polyline is in the behavior of the stroke: for a polygon, the stroke is terminated by itself (shape on the left), while for a polyline it remains open (shape on the right):

Comments

  • object.svg
  • style.css
SVG
<svg width="200" height="200"> </svg>
CSS
svg { border: 1px solid #dddddd; }

What didn’t you like in this task?

Thanks! We’ll fix everything at once!

The code has changed, click “Refresh” or turn autorun on.

You’ve gone to a different page

Click inside the mini-browser to shift the focus onto this window.

100%
Goalscompleted
0
    1. Draw a line with the coordinates 50,180 100,20 150,180 20,80 180,80 50,180 100,20.
    2. Set the stroke color to red with a thickness of 5 pixels. To remove the black fill color, set the fill attribute to none.

    Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2025

    VISAMastercard

    Log in

    or

    Forgot your password?

    Sign up

    Sign up

    or
    Log in

    Restore access

    Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

    Forgot to connect your email to the profile? Email us and we’ll help.