Re: Scaling SVG to fit in html tables

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 UTC