Jump to content

Hello! Is there any way to add class to a specific svg?


Recommended Posts


Is there any way I can add a specific class to svg tag?

I try to do that:

	stroke: lightblue;
	stroke-width: 2px;
	right: 0px;
	top: 10px;
	margin:0px 0px 0px 0px;
	padding:0px 0px 0px 0px;

And in the body:

<svg class="svgclass"><line x1="0" y1="0" x2="0" y2="80" /></svg>

This is not work...

(And the svg style is set good, cause when I remove the class from the svg, and change in the css file to svg its all great..)


Thanks! (:

Link to comment
Share on other sites

  • 2 years later...

First, your "display:inline-block;" may contradict your other position data. 

Second, the examples I have seen so far put the height and width in the tag definition, as in <svg width="200" height="200" class="svgclass" ></svg> .

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...