0Pricing
HTML Academy · Lesson

Basic SVG Shapes rect circle path

Draw common shapes with SVG elements.

SVG Coordinate System

SVG uses a coordinate system where (0,0) is the top-left corner. X increases rightward; Y increases downward. The viewport is defined by the width and height attributes; the coordinate space is defined by the viewBox attribute.

rect Element

Draw rectangles with <rect x="10" y="10" width="200" height="100" rx="8" ry="8">. rx and ry round the corners. Fill and stroke are controlled by fill and stroke attributes or CSS. Omitting x and y defaults to 0,0.

All lessons in this course

  1. Inline SVG vs img and object
  2. Basic SVG Shapes rect circle path
  3. SVG viewBox and Responsive Scaling
  4. Animating SVG with CSS and SMIL
← Back to HTML Academy