SVG stroke

I’m trying to change the stroke color of the line connecting the 2 rooms

I put the shape in a class, and have

.connector:hover { 
	stroke: blue;

in the css

Try removing the in-line stroke styling from the element as this will override the CSS.

1 Like

I tried, and put the stroke: black;
in the head for the class, took out the inline style for the color and its gone.

Is it not seeing the class?

Oh, my bad.

It works great now, so now Im going to figure out how to do this using paths instead.

Hi there lurtnowski,.

you may find that this amendment makes the line hover more accessible…

<svg viewBox="0 0 1000 800" xmlns="">
    text { font: bold 18px verdana; }
.link {
    fill: lightgray;
    pointer-events: all;
.link:hover { 
    fill: silver;
	 stroke: white;
.connector polygon {
.connector:hover polygon{ 
	stroke: blue;

  <a xlink:href="#openModal_169">
   <rect width="300" height="200" style="stroke-width:2;stroke:rgb(0,0,0)" class="link"/>
   <text x="95" y="20" fill="black">Room 169</text>
  <a xlink:href="#openModal_180">
   <rect x="400" y="250" width="200" height="150" style="stroke-width:2;stroke:rgb(0,0,0)" class="link"/>
   <text x="450" y="270" fill="black">Room 180</text>
  <a xlink:href="#openModal_169-180" class="connector">
   <rect width="512" height="48" x="49" y="201" fill="transparent" stroke="none"/>
   <polygon points="50,200, 50,225, 560,225, 560,250
					560,250,560,225,50,225,50,200" />  


1 Like

ok, now that I got this example working, now I am going to do the same thing using your second example from before where you use paths.

Drawing the connector line was kind of confusing, I had to draw the polygon, then because I was getting a diagonal line from the start to the end point, I drew it again in reverse.

Is it better if I follow your lead and use for everything?

Hi there lurtnowski

I didn’t notice that your line retraced it’s steps. :unhappy:

Using “path” instead of “polygon” will rectify that…

  <a xlink:href="#openModal_169-180" class="connector">
   <rect width="512" height="48" x="49" y="201" fill="transparent" stroke="none"/>
   <path d="M50,200, 50,225 560,225 560,250"/>


ok, whats the deal with the <rect>?

If you are asking that question. then I must presume
that you have not tested the code. :wonky:

The “deal” is that instead of having to hover over
the thin line to change it’s color, hovering over the
area that contains the line, will change it’s color. :winky:


1 Like


Hi there lurtnowski,

oooooooops, sorry about that. :unhappy:

The code should, of course, have been…

   <path d="M50,200, 50,225 560,225 560,250" fill="transparent"/>


1 Like

Hey, why does the SVG render small when using IE as a browser, but perfect in Chrome?

I honestly don’t know, but I also discovered some strange behavior of IE displaying SVGs over the weekend. I was thinking of making a topic to find out why.
It’s probably just another of IE’s many quirks.

1 Like

This problem was discussed in another thread of yours, starting
round about post #9

Whats the best method?


1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.