SVG polygon points with percentage units support

By using viewBox and a container element (of whatever size) I think you can achieve the effect you’re looking for: http://jsfiddle.net/davegaeddert/WpeH4/

<div id="svg-container" style="width:100%;height:100%;">
    <svg width="100%" height="100%" viewBox="0 0 100 100" preserveAspectRatio="none" style="background-color: whitesmoke">
        <rect x='40%' y='40%' width="25%" height="25%" />

        <polygon points="0,0 0,100 30,20 30,0" />
        <polygon points="30,0 30,20 60,0 60,0" />
        <polygon points="60,0 60,0 90,30 90,0" />
    </svg>
</div>

If you give the viewBox a size of 0 0 100 100 then the points can be written like percentages and the shape will scale with the svg.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)