Answers

Question and Answer:

  Home  SVG

⟩ How you can specify a border to a rectangle?

Following is the code snippet for drawing a rectangle:

<?xml version="1.0" standalone="no"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"

"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100%" height="100%" version="1.1"

xmlns="http://www.w3.org/2000/svg">

<rect width="400" height="200" />

</svg>

The style attribute is specified in the <rect> tag to specify the border color. This is illustrated in the following code snippet:

<rect width="400" height="200" style="fill:rgb(0,0,255);stroke-width:1;

stroke:rgb(0,0,0)"/>

The property 'fill' defines the color to fill the rectangle.

The property 'stroke-width' defines the width of the border of the rectangle.

 185 views

More Questions for you: