2012-10-05 50 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; 
}