W3C home > Mailing lists > Public > www-svg@w3.org > February 2002

Re: Why do some SVG scale and others don't?

From: Dean Jackson <dean@w3.org>
Date: Wed, 20 Feb 2002 12:43:39 +1100
To: Peter Sheerin <pete@petesguide.com>
Cc: www-svg@w3.org
Message-ID: <20020220014339.GH8291@grorg.org>
On Tue, 19 Feb 2002, Peter Sheerin wrote:

> I've come across a few sample SVG images that, when viewed directly in a browser, appear to be the same size (say 100px) no matter how wide the browser is, and other SVG images that stretch to the entire width, maintaining their aspect ratio.
> 
> Looking at the source, I can find no clear differentiator between these two appearances. How do I modify a fixed-size SVG image to scale automatically?

The standard way is to use the viewBox attribute. If I don't
want to specify an exact size I usually do something like this.

<svg width="100%" height="100%" viewBox="0 0 500 500">
Received on Tuesday, 19 February 2002 20:47:04 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:21 GMT