javascript - 防止svg边框渐变颜色

标签 javascript css svg

我注意到 svg 在元素周围的非常小的像素中添加了一些渐变边框。这是它的 jsfiddle:

http://jsfiddle.net/XrkRT/

<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 中放大。这是图片:

enter image description here

最佳答案

这就是抗锯齿。您可以使用 shape-rendering 将其关闭="crispEdges"但请注意,任何对 Angular 线看起来都会更粗糙。

关于javascript - 防止svg边框渐变颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19527197/

相关文章:

javascript - 揭示模块模式添加子模块和访问私有(private)函数

javascript - 悬停时高效的 JS 事件监听器

html - 水平滚动和图像的自动多列固定高度问题

javascript - 将禁用样式 (css) 添加到输入类型文件按钮

javascript - Jest getReversedNavigationSections 为 null

javascript - 有条件导入 npm 模块?

html - flexbox 对齐内容不会在元素之间留下空间

html - 带 SVG 的 Div,分栏两行文本和下划线,无内联代码

javascript - 在 HTML 页面中嵌入的 SVG 对象中使用 Adob​​e TypeKit 字体

jquery - 在 svg 路径元素上添加类