4

I am a newbie to SVG. I was wondering what attribute I could use to add an outline/border to an ellipse element in SVG code? Actually, I am trying to make an interactive graph using SVG and jQuery, so I need to have certain selected ellipse elements display a solid outline of a specific color (like dark red) when an event happens. I'd like to know how this can be done.

Thanks!

assassin
  • 19,899
  • 10
  • 30
  • 43

2 Answers2

5

Do you mean something like this?

<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> 

Where the ellipse has a purple edge. Or do you mean a square box round the ellipse which you'd need to do separately like this?

<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> 
Robert Longson
  • 118,664
  • 26
  • 252
  • 242
0

In CSS, something like:

path {
  fill: none;;
  stroke: #646464;
  stroke-width:1px
  stroke-dasharray: 2,2;
  stroke-linejoin: round;
}
Hugolpz
  • 17,296
  • 26
  • 100
  • 187