我注意到 svg 在元素周围的非常小的像素中添加了一些渐变边框。这是它的 jsfiddle:
<rect x="1" y="1" width="1198" height="398"
fill="none" stroke="blue" stroke-width="10" />
<g stroke="green" >
<line x1="100" y1="300" x2="300" y2="300"
stroke-width="20" fill="none" />
</g>
如何绘制纯色线和矩形。普通变焦很难看清。我截屏并在 pixlr.com 中放大。这是图片:
最佳答案
这就是抗锯齿。您可以使用 shape-rendering 将其关闭="crispEdges"但请注意,任何对 Angular 线看起来都会更粗糙。
关于javascript - 防止svg边框渐变颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19527197/