如何在CSS中的SVG元素添加边框/大纲/描边? [英] How to add border/outline/stroke to SVG elements in CSS?

查看:1098
本文介绍了如何在CSS中的SVG元素添加边框/大纲/描边?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于D3js,我将SVG元素注入到网页中。我难以对这些元素进行样式化,因为

I'am injecting SVG elements into a webpage thanks to D3js. I have difficulties to style these elements since syntaxes like

path { border: 3px solid green; }

无效。

如何在包含CSS的网页中向SVG元素添加边框/大纲/描边?

推荐答案

在CSS 中:

path {
  fill: none;;
  stroke: #646464;
  stroke-width:1px;
  stroke-dasharray: 2,2;
  stroke-linejoin: round;
}

这篇关于如何在CSS中的SVG元素添加边框/大纲/描边?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆