简体   繁体   中英

How to get rid of hairline from overlapping svg shapes

I am using d3 and SVG to draw a rectangle. I then draw a different rectangle that is smaller and a different color inside the first rectangle. When I change the smaller rectangle to the same color as the bigger one you can see a white outline of where the smaller rectangle was. What is the bet way to fix this so that the smaller one just blends into the bigger one?

As long as your smaller inside rectangle has no stroke colour, then it should not be visible.

 <svg width="400" height="200"> <rect x="20" y="20" width="160" height="160" fill="red"/> <rect x="50" y="50" width="100" height="100" fill="green"/> <rect x="220" y="20" width="160" height="160" fill="red"/> <rect x="250" y="50" width="100" height="100" fill="red"/> </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