Jump to content

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


Novadia
 Share

Recommended Posts

Hello!

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

I try to do that:

.svgclass{
	stroke: lightblue;
	stroke-width: 2px;
	display:inline-block;
	position:absolute;
	z-index:1;
	right: 0px;
	top: 10px;
	margin:0px 0px 0px 0px;
	padding:0px 0px 0px 0px;
	height:80px;
	width:1px;
}

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
 Share

×
×
  • Create New...