[SVG] How to draw a rectangle?

2020-12-09 02:33:09 | Web Design | 1k+ Reads

Previous: [SVG] How to draw a circle?

Code:

<svg >
  <rect width="300" height="100" style="stroke:rgb(0,0,0);stroke-width:2;fill:transparent;" />
</svg>
<svg>
  <rect width="300" height="100" stroke="black" stroke-width="2" fill="transparent" />
</svg>

Show results:

   

Why did I write two examples? 

This is simply another way of writing that I want to tell you, which is written in "style", even though they are separate attributes.

stroke:rgb(0,0,0) ⇔ stroke=black

This is another way to show colors.

Next: [SVG] How to draw polygons?

This article was last edited at 2020-12-09 02:57:15