There are 3 possibilities:
- calculate the x-y-offset of the rectangle depending on the stroke-width to compensate the offset dislocation of the stroke-width:
offset-x
and offset-y
values are stroke-width / 2
<svg width="200" height="200" style="border: solid blue 5px;">
<rect x="15" y="15" height="50" width="100" stroke="purple" stroke-width="30px" fill="green"/>
</svg>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…