2012-10-05 46 views
1

我是SVG的新手。我想知道我可以使用什么属性来将轮廓/边框添加到SVG代码中的椭圆元素中?实际上,我正在尝试使用SVG和jQuery创建一个交互式图形,因此当事件发生时,我需要让某些选定的椭圆元素显示特定颜色(如深红色)的轮廓。我想知道如何做到这一点。如何将大纲/边框添加到SVG中的椭圆元素中?

谢谢!

+0

边界≈行程(见http://www.w3.org/TR/SVG11/painting.html#StrokeProperties) –

+0

疑难杂症.. 。 谢谢! :) – assassin

回答

2

你的意思是这样的吗?

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" 
    width="100%" height="100%"> 
    <ellipse cx="300" cy="80" rx="100" ry="50" 
    fill="yellow" stroke="purple" stroke-width="2"/> 
</svg> 

椭圆有紫边的地方。或者你的意思是一个椭圆形的方形盒子,你需要分别这样做?

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" 
    width="100%" height="100%"> 
    <ellipse cx="300" cy="80" rx="100" ry="50" fill="yellow"/> 
    <rect x="200" y="30" width="200" height="100" 
    fill="none" stroke="purple" stroke-width="2"/> 
</svg> 
+0

我的意思是第一个。谢谢! – assassin

0

在CSS,是这样的:

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