Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I posted a fiddle here, showing data, remote and local images embedded in SVG, inside an HTML page:</p> <p><a href="http://jsfiddle.net/MxHPq/">http://jsfiddle.net/MxHPq/</a></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;SVG embedded bitmaps in HTML&lt;/title&gt; &lt;style&gt; body{ background-color:#999; color:#666; padding:10px; } h1{ font-weight:normal; font-size:24px; margin-top:20px; color:#000; } h2{ font-weight:normal; font-size:20px; margin-top:20px; } p{ color:#FFF; } svg{ margin:20px; display:block; height:100px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;SVG embedded bitmaps in HTML&lt;/h1&gt; &lt;p&gt;The trick appears to be ensuring the image has the correct width and height atttributes&lt;/p&gt; &lt;h2&gt;Example 1: Embedded data&lt;/h2&gt; &lt;svg id="example1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"&gt; &lt;image x="0" y="0" width="5" height="5" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="/&gt; &lt;/svg&gt; &lt;h2&gt;Example 2: Remote image&lt;/h2&gt; &lt;svg id="example2" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"&gt; &lt;image x="0" y="0" width="275" height="95" xlink:href="http://www.google.co.uk/images/srpr/logo3w.png" /&gt; &lt;/svg&gt; &lt;h2&gt;Example 3: Local image&lt;/h2&gt; &lt;svg id="example3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"&gt; &lt;image x="0" y="0" width="136" height="23" xlink:href="/img/logo.png" /&gt; &lt;/svg&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload