简体   繁体   中英

svg - draw hollow rectangle(rect donut)?

Can anybody help me with drawing hollow rectangle with svg WITHOUT using any js lib(eg Raphael)?
In basic, it should be same idea as "donut shape" but rectangle.
something like this:

在此处输入图片说明

Here you go

<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 2624 1462" width="1312" height="736" id="svg2">

  <path d="M 80,112 l 528,0 0,528 -528,0 z m -64,-64.000003 656,0 0,656.000023 -656,0 z" fill="gold" stroke="black" fill-rule="evenodd" />

</svg>

The path winds in one direction outside and the other inside and the evenodd fill-rule cuts out the middle.

Here's an example :

<svg viewBox="0 0 400 400" shape-rendering="crispEdges">
    <path d="M10,10h100v100h-100zM20,20v80h80v-80z" fill="yellow" stroke="black"/>
</svg>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM