Derk Jan Speelman Derk Jan Speelman - 1 month ago 5x
CSS Question

It is possible to give <path> tag a class for css purposes?

I'd like to have two paths in my svg with classes so i can toggle opacity when I hover the svg with my mouse.


The answere to this question is easy to find, but anyway: yes it is. See the Global Attributes in

.shape {
  opacity: .5;
<svg width="300px" height="300px" viewBox="0 0 500 500" xmlns="">
  <path class="shape" d="M 100 100 L 300 100 L 200 300 z" fill="orange" stroke="black" stroke-width="5" />