Add an inline SVG containing a circle.
Acceptance criteria
- 1.Add an inline SVG containing a circle.
HTML Tutorial · HTML Tags
These 10 tasks go with the HTML <svg> Tag chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “puts vector graphics directly into HTML. Unlike a PNG or JPEG, an SVG is made of shapes described in code, so it stays sharp at any size, can be styled with CSS, and can be changed with JavaScript. It is how nearly every icon on the modern web is drawn.” .
1.Draw a circleexercise · easy · 10 min
Add an inline SVG containing a circle.
Passes when: Add an inline SVG containing a circle.
2.Set a viewBoxexercise · easy · 10 min · practice plan
Give the SVG a viewBox so it scales.
Passes when: Give the SVG a viewBox so it scales.
3.Draw a rectangleexercise · easy · 10 min · practice plan
Add a rectangle inside the SVG.
Passes when: Add a rectangle inside the SVG.
4.Name the graphicexercise · easy · 10 min · practice plan
Give the SVG an accessible label.
Passes when: Give the SVG an accessible label.
5.A titled, scalable iconexercise · medium · 10 min · practice plan
Build a labelled SVG with a viewBox and one shape.
Passes when: Build a labelled SVG with a viewBox and one shape.
6.Fix the image used for a shapebug fix · easy · 8 min
An inline shape is drawn with svg.
Passes when: An inline shape is drawn with svg.
7.Fix the SVG that cannot scalebug fix · easy · 8 min · practice plan
Without a viewBox the drawing is fixed.
Passes when: Without a viewBox the drawing is fixed.
8.Fix the div used as a shapebug fix · easy · 8 min · practice plan
A rectangle inside an SVG is a rect element.
Passes when: A rectangle inside an SVG is a rect element.
9.Fix the unnamed graphicbug fix · easy · 8 min · practice plan
An SVG conveying meaning needs a label.
Passes when: An SVG conveying meaning needs a label.
10.Fix the alt used on an SVGbug fix · easy · 8 min · practice plan
Inline SVG has no alt; it is labelled with aria-label.
Passes when: Inline SVG has no alt; it is labelled with aria-label.
Between them these tasks cover Inline SVG, viewBox and Accessible names.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.