viewbox and length,width

abacus
06-15-2004, 10:41 PM
hi,
i'm new to svg
what is the difference between viewBox,length,width attributes in svg tag.
view box includes the width and height.so why different height,weight attributes
regards,
abacus

Anonymous
06-16-2004, 02:34 AM
Hi abaccus

width and height attributes determine the physical width and height(visible area) of the drawing,
wereas the width and height specified b viewBox determine the width and height of the user-coordinate system.

<svg width="100px" height="100px" viewBox="0 0 200 200">
<rect x="0" y="0" width="100" height="100"/>
</svg>

with this you say that one user-coordinate unit is 0.5px.so the rect will have a dimension
of 50px X 50px.

here is a second example:

<svg width="2in" height="2in" viewBox="0 0 100 100">
<rect x="0" y="0" width="50" height="50"/>
</svg>

one user-coordinate unit is now 1/50 in.so the rect will have a dimension
of 1in X 1 in.

this is extremly useful for paths since there is no way to specify units for a path.
path coordinates are allwas in user-coordinate units.

hope it helps
have fun
Holger

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum