SVG in HTML is not rendered

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

SVG in HTML is not rendered

praveenreddy
hi, i'm trying to insert an SVG element containing a "path" element in HTML.I'm overlaying the SVG over HTML using z-index. However, the SVG is not rendered. However, if i create an SVG file with the same "path", the SVG is rendered. I've included two files one a HTML file and the other an SVG file. I'm using Firefox 3.0.1 .testpage.htmltestpage.svg Alternatively, i've included the code here.

testpage.html

<html><body id="body" style="z-index: -1;">

hello world

<svg xmlns="http://www.w3.org/2000/svg" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"  height="499" width="1024" style="position: absolute; top: 0px; left: 0px; z-index: 2147483646; visibility: visible;" ><g><path style="stroke-width: 2px; visibility: visible;" stroke="#FFE251" fill="none" d="M463 119,431 119,397 119,363 119,327 125,293 131,261 141,235 153,211 165,187 175,167 187,155 199,145 211,137 225,133 237,133 251,135 267,143 279,155 291,175 307,199 321,223 337,251 353,281 367,317 375,359 381,403 387,451 393,495 393,535 393,571 393,607 389,641 385,673 375,703 363,729 351,753 339,777 321,797 303,813 283,825 267,833 251,837 237,839 223,839 207,837 193,831 179,823 167,813 155,801 147,789 137,775 125,759 115,743 107,723 101,705 93,683 87,659 83,635 77,611 75,585 71,561 71,537 71,515 71,491 71,469 71,443 73,419 73,395 77,377 79,357 83,343 85,329 89,315 91,303 97,293 99,287 105,283 109,277 113,273 119,269 121,267 125,265 129,263 131,261 135,259 137,257 139,257 140,255 144,255 148,255 154,255 160,255 168,255 176,255 184,255 194,255 198,253 204,253 210,253 211,253 215"></path></g></svg></body></html>

testpage.svg

<svg xmlns="http://www.w3.org/2000/svg" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink" ><g>
    <path style="stroke-width: 2px; visibility: visible;" stroke="#FFE251" fill="none" d="M463 119,431 119,397 119,363 119,327 125,293 131,261 141,235 153,211 165,187 175,167 187,155 199,145 211,137 225,133 237,133 251,135 267,143 279,155 291,175 307,199 321,223 337,251 353,281 367,317 375,359 381,403 387,451 393,495 393,535 393,571 393,607 389,641 385,673 375,703 363,729 351,753 339,777 321,797 303,813 283,825 267,833 251,837 237,839 223,839 207,837 193,831 179,823 167,813 155,801 147,789 137,775 125,759 115,743 107,723 101,705 93,683 87,659 83,635 77,611 75,585 71,561 71,537 71,515 71,491 71,469 71,443 73,419 73,395 77,377 79,357 83,343 85,329 89,315 91,303 97,293 99,287 105,283 109,277 113,273 119,269 121,267 125,265 129,263 131,261 135,259 137,257 139,257 140,255 144,255 148,255 154,255 160,255 168,255 176,255 184,255 194,255 198,253 204,253 210,253 211,253 215"></path>
  </g>
</svg>

 Any help is appreciated. Thanks,

regards,
Praveen Reddy
Reply | Threaded
Open this post in threaded view
|

Re: SVG in HTML is not rendered

Martin Honnen-3
praveenreddy wrote:
> hi, i'm trying to insert an SVG element containing a "path" element in
> HTML.I'm overlaying the SVG over HTML using z-index. However, the SVG is not
> rendered. However, if i create an SVG file with the same "path", the SVG is
> rendered. I've included two files one a HTML file and the other an SVG file.
> I'm using Firefox 3.0.1 . http://www.nabble.com/file/p19048063/testpage.html
> testpage.html  http://www.nabble.com/file/p19048063/testpage.svg
> testpage.svg  

If you want to embed SVG in a HTML document then you need to author
XHTML and you need to serve the document with an XML MIME type e.g.
application/xml.

--

        Martin Honnen
        http://JavaScript.FAQTs.com/
_______________________________________________
dev-tech-svg mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-svg
Reply | Threaded
Open this post in threaded view
|

Re: SVG in HTML is not rendered

Jeff Schiller
On Aug 19, 6:01 am, Martin Honnen <[hidden email]> wrote:

> If you want to embed SVG in a HTML document then you need to author
> XHTML and you need to serve the document with an XML MIME type e.g.
> application/xml.

I thought the preferred MIME type for XHTML was application/xhtml+xml?

Also, Google Maps and Live Maps are able to generate SVG path elements
using the DOM in text/html, so that might be another option...
_______________________________________________
dev-tech-svg mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-svg
Reply | Threaded
Open this post in threaded view
|

Re: SVG in HTML is not rendered

Martin Honnen-3
codedread wrote:
> On Aug 19, 6:01 am, Martin Honnen <[hidden email]> wrote:
>
>> If you want to embed SVG in a HTML document then you need to author
>> XHTML and you need to serve the document with an XML MIME type e.g.
>> application/xml.
>
> I thought the preferred MIME type for XHTML was application/xhtml+xml?

For pure XHTML, yes, but a mixture of XHTML and SVG can certainly be
served as application/xml. application/xhtml+xml should work too.

--

        Martin Honnen
        http://JavaScript.FAQTs.com/
_______________________________________________
dev-tech-svg mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-svg
Reply | Threaded
Open this post in threaded view
|

Re: SVG in HTML is not rendered

Jonas Sicking-2
Martin Honnen wrote:

> codedread wrote:
>> On Aug 19, 6:01 am, Martin Honnen <[hidden email]> wrote:
>>
>>> If you want to embed SVG in a HTML document then you need to author
>>> XHTML and you need to serve the document with an XML MIME type e.g.
>>> application/xml.
>>
>> I thought the preferred MIME type for XHTML was application/xhtml+xml?
>
> For pure XHTML, yes, but a mixture of XHTML and SVG can certainly be
> served as application/xml. application/xhtml+xml should work too.

Be warned though. If you use "application/xml" we'll create a plain XML
Document, which means that it won't have HTML specific methods like
.cookies or .forms

/ Jonas
_______________________________________________
dev-tech-svg mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-svg
Reply | Threaded
Open this post in threaded view
|

Re: SVG in HTML is not rendered

moueza
In reply to this post by Martin Honnen-3
On 19 août, 14:09, Martin Honnen <[hidden email]> wrote:

> codedread wrote:
> > On Aug 19, 6:01 am, Martin Honnen <[hidden email]> wrote:
>
> >> If you want to embed SVG in a HTML document then you need to author
> >> XHTML and you need to serve the document with an XML MIME type e.g.
> >> application/xml.
>
> > I thought the preferred MIME type for XHTML was application/xhtml+xml?
>
> For pure XHTML, yes, but a mixture of XHTML and SVG can certainly be
> served as application/xml. application/xhtml+xml should work too.
>
> --
>
>         Martin Honnen
>        http://JavaScript.FAQTs.com/

Include an empty .htaccess file in the server's  repository
_______________________________________________
dev-tech-svg mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-svg
Reply | Threaded
Open this post in threaded view
|

Re: SVG in HTML is not rendered

praveenreddy
In reply to this post by praveenreddy
Thank you, it worked with an XHTML document.

regards,
praveen reddy