Why Are SVG Objects Always Drawn Later? September 13, 2022 Post a Comment In my HTML5 page, I'm incorporating SVG with fallback the following way. Behind is a background : Solution 1: SVG object are not always drawn later. It depends on the way they are embbed in the HTML page. If you want an instant drawing of the SVG and a fallback without javascript, you have to use either : The CSS background technique The SVG will be referenced in the CSS. Because CSS is loaded in the head section, it will draw the SVG as it appears in the HTML code. .my-element { background-image: url(fallback.png); background-image: linear-gradient(transparent, transparent), url(image.svg); } Copy More details on how to use this technique The inline SVG with foreignObject technique Because it's inline, the SVG will be drawn as it appears in the HTML code.Baca JugaHow To Send An Html Form To An EmailPropagating View's Dirty State To The Containing FormChinese Font On The Web Rendering Differently In Different Browsers <svg> <switch> <g> /* Here the SVG code */ </g> <foreignObject> /* Here the image fallback */ </foreignObject> </switch> </svg> Copy More details on how to use this technique All the others SVG inclusion techniques, will result in a delay in the displaying of the SVG. Share You may like these postsJavascript Change Class OnclickHow Can I Display A Header Element Above My Content?How To Force Elements To Stay In The Same RowTranslate Html Files To Another Language Post a Comment for "Why Are SVG Objects Always Drawn Later?"