I am working on my responsive svg component for my website. I am trying to create svg element that can scale automatically on window resize. I have set up viewBox="0 0 1000 240"
and preserveAspectRatio="xMidYMin slice"
. It works fine in FF, Chrome and Edge but in IE I have an issue. <svg>
element height not changing correctly. It always have fixed height.
Here is my code:
<div class="scaling-svg-container">
<svg version="1.1" width="100%" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin slice" viewBox="0 0 1000 240" class="scaling-svg">
<defs></defs>
<rect x="0" y="0" width="100%" height="100%" fill="#dbf2b5"></rect>
</svg>
<h1> This text should be under svg element. But not working in IE</h1>
</div>
http://codepen.io/anon/pen/LGayeZ
How can I avoid this issue?
Thanks