Embeding SVG in HTML

S

Sascha Kerschhofer

Hi,

I am embeding my SVG Files in HTML in this way:
<OBJECT DATA="foo.svg" WIDTH="300" HEIGHT="200" TYPE="image/svg+xml"> (using
Acrobat SVG Viewer)
Since I create the SVG dynamicaly the WIDTH and HEIGHT is unknown, when
loading the HTML page. Can I embed SVG like I can do it with images without
defining WIDTH and HEIGHT. Simply "oversize" both attributes unnecessarily
produces scrollbars in the browser window.

Sascha Kerschhofer
 
R

Red Ogden

One solution would be to dynamically generate the html file and hence
the height width attributes, using your SVG stylesheet.

Redge.
 
E

Ed Beroset

One solution would be to dynamically generate the html file and hence
the height width attributes, using your SVG stylesheet.

There's another simple way to do it, which is to specify it like this:

<object data="foo.svg" width="100%" height="100%" type="image/svg+xml">

That way, no scroll bars will be shown and you'll get the SVG sized to
to the currently available area.

Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top