Embeding SVG in HTML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sascha Kerschhofer

    #1

    Embeding SVG in HTML

    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


  • Red Ogden

    #2
    Re: Embeding SVG in HTML

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

    Redge.

    "Sascha Kerschhofer" <skerschhofer@y ahoo.de> wrote in message news:<bdbffj$re 3$1@news.mch.sb s.de>...[color=blue]
    > 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[/color]

    Comment

    • Ed Beroset

      #3
      Re: Embeding SVG in HTML

      Red Ogden wrote:[color=blue]
      > "Sascha Kerschhofer" <skerschhofer@y ahoo.de> wrote in message news:<bdbffj$re 3$1@news.mch.sb s.de>...
      >[color=green]
      >>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[/color][/color]
      [color=blue]
      > One solution would be to dynamically generate the html file and hence
      > the height width attributes, using your SVG stylesheet.[/color]

      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

      Comment

      Working...