Comment 38 for bug 168261

Revision history for this message
Colin Finck (colinfinck) wrote :

If I embed a SVG file from the Tango Icon Library
(http://tango-project.org/releases/tango-icon-theme-0.7.2.tar.gz), which
has been created with Inkscape, it is unresizable in Firefox (tested with
2.0.0.1).

I looked into the SVG file and found that it defines the parameters
'width="48px" height="48px"'.
If I replace these parameters with 'viewBox="0 0 48 48"', the SVG will be
resized correctly under Firefox using the following syntax:

<object data="internet-mail.svg" type="image/svg+xml" style="width: 32px;
height: 32px;" />

Otherwise the image will be cropped.
See the attached example for more details.

I'm not an expert in SVG, so I cannot tell you the best solution here.
But in my opinion, Inkscape should only use the 'viewBox' parameter and
drop the 'width' and 'height' parameters. Otherwise you cannot scale the
created files in Firefox.
Other SVG files I found, for example the feed icon at
http://www.feedicons.com, also use only a 'viewBox' parameter and no
'width' and 'height' parameters. Therefore they scale correctly under
Firefox.