HTML Academy
Previous task
An Introduction to SVG1/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
Drawing a Rectangle
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Hello, SVG!

SVG is a vector graphics format. Unlike raster graphics (such as PNG, GIF, and JPEG), SVG can be stretched and shrunk without loss of quality. In other words, these types of images will be equally clear on both standard resolution and retina screens.

Another advantage of SVG is its human-readable code: you can not only read it, but also write it manually as well. You can open a file and edit it without using a graphics editor, meaning that you can write a simple image yourself.

In addition, SVG elements can be styled with CSS, and you can add interactivity to them with JavaScript. In addition, SVG is also reasonably well supported by all modern browsers, and you can start actively using it today.

Let’s learn a little bit more about it. Here’s a simple code example:

<svg>
  <circle r="50" cx="50%" cy="50%" fill="yellowgreen"/>
</svg>

The SVG element is inserted using the svg tag. The rest of the content is nested inside of this tag, including shapes, images, or text.

The content in this example is a circle (circle) that has been colored green (fill="yellowgreen"). This is what this code will look like in a browser:

SVG can be embedded in several different ways. We will examine them in more detail later, but for now we will embed the file directly into the page code.

Comments

  • object.svg
  • style.css
SVG
<svg> <circle r="50" cx="50%" cy="50%" fill="yellowgreen" /> </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. Change the color of the circle to orange.

    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.