W3C home > Mailing lists > Public > www-svg@w3.org > July 2006

Re: Scaling SVG to fit in html tables

From: Chris Lilley <chris@w3.org>
Date: Tue, 25 Jul 2006 11:40:13 +0200
Message-ID: <0822897.20060725114013@w3.org>
To: "nscharfe (sent by Nabble.com)" <lists@nabble.com>
Cc: www-svg@w3.org, nscharfe <nscharfe@stanford.edu>

On Tuesday, July 25, 2006, 1:50:26 AM, nscharfe wrote:


nsbNc> I am embedding varous SVG files into an html table using an <embed> tag. I am
nsbNc> unable to scale the images appropriately so that they fit exactly in the
nsbNc> <td> tag that the <embed> tag is in. I was thinking of setting the width and
nsbNc> height of the embed to 100%, but that doesn't seem to work. 

nsbNc> Any help on this topic is greatly appreciated.

The SVG will scale itself to fit in whatever space the HTML (well,the CSS) tells it to. Normally it will preserve the aspect ratio, as well; if you don't want that, set preserveAspectRatio="none".

Assuming that you also have width="100%" height="100%" and a viewBox, you are all set on the SVG side.

For the HTML/CSS side, I suggest asking on www-style@w3.org. However, the relative widths of the columns needs to be set *somewhere* so I suggest looking at table-layout: fixed
http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout


-- 
 Chris Lilley                    mailto:chris@w3.org
 Interaction Domain Leader
 Co-Chair, W3C SVG Working Group
 W3C Graphics Activity Lead
 Co-Chair, W3C Hypertext CG
Received on Tuesday, 25 July 2006 09:40:23 GMT

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