I am trying to make this <svg>
element stretch to 100% of the screen width:
<svg height="100" width="100"> <path d="M0 0 L100 0 L50 100 Z" /> </svg>
What do I need to do?
The viewBox defines the co-ordinates you can see. Height and width define the size of the SVG. E.g.
html, body { width: 100%; height: 100%; }
<svg height="100%" width="100%" viewBox="0 0 100 100" preserveAspectRatio="none"> <path d="M0 0 L100 0 L50 100 Z" /> </svg>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With