Set the size of an element to a given
Proportional resizing is also possible by leaving out
Or by passing
null as the value for
As with positioning, the size of an element could be set by using
attr(). But because every type of element is handles its size differently the
size() method is much more convenient.
There is one exception though: for
SVG.Text elements, this method takes only one argument and applies the given value to the
width() as setter
Set the width of an element:
width() as getter
var width = rect.width()
height() as setter
Set the height of an element:
height() as getter
Circles, ellipses, and rects may use the
radius() method. On rects, it defines rounded corners.
For a circle, the argument sets the
For ellipses and rects, pass two arguments to set the
ry attributes individually. Or, pass a single argument, to make the two attributes equal.
ellipse.radius(10, 20) rect.radius(5)