Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add an outline/border to an ellipse element in SVG?

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!

like image 789
assassin Avatar asked Oct 27 '25 04:10

assassin


1 Answers

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> 
like image 54
Robert Longson Avatar answered Oct 29 '25 19:10

Robert Longson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!