css - SVG:在同一个(x,y)上创建2个矩形会创建不需要的边框
问题描述
.rect-x {
fill: red;
}
.rect-y {
fill: pink;
}
<svg viewBox="0 0 1024 768">
<rect class="rect-x" x="0" y="0" width="100" height="100"></rect>
<rect class="rect-y" x="0" y="0" width="100" height="100"></rect>
</svg>
问题截图:
为什么会这样?
我该如何处理?
解决方案
尝试添加shape-rendering="crispEdges"
以禁用抗锯齿
.rect-x {
fill: red;
}
.rect-y {
fill: pink;
}
<svg viewBox="0 0 1024 768">
<rect class="rect-x" x="0" y="0" width="100" height="100"></rect>
<rect class="rect-y" x="0" y="0" width="100" height="100"></rect>
<rect class="rect-x" x="200" y="0" width="100" height="100" shape-rendering="crispEdges"></rect>
<rect class="rect-y" x="200" y="0" width="100" height="100" shape-rendering="crispEdges"></rect>
</svg>
推荐阅读
- logging - SAS:创建具有对数关系的图形
- botframework - skype bot 模拟真人
- node.js - 网络空闲 15-20 分钟后调用 sendTransaction 失败
- python - 如何访问另一个RDD中的RDD?
- android - 颤动 - 当我更改 textFormField 上的文本时,光标移动开始
- reactjs - 添加计数器以显示在 ap 标签中单击按钮的次数
- python-3.x - 输入单词时如何从 Tkinter 文本框中获取输入单词?
- julia - 保持 Julia 中的数据结构易于管理
- hibernate - 表单未正确提交:由于被认为是客户端错误,服务器无法或不会处理请求
- android - 能够滚动无休止的循环回收器视图,但无法单击特定列表项