R
R
ravlex2016-06-29 17:46:16
css
ravlex, 2016-06-29 17:46:16

How to color fill an SVG image on hover?

I connect this way <img class="mapkr1" src="img/map/1.svg" alt="">.
I'm trying to fill with color:

.mapkr1:hover {
fill: orange;
}

But nothing happens.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-06-29
@webinar

css is correct, but will not work if in html as an image. how to insert svg

M
Minary, 2016-06-30
@Minary

If for some reason you don't like the option of inserting SVG directly into the document, you can include an SVG file using the ability to control via CSS.
The html file will be:
And you also need to add to the SVG file before the opening < svg > tag:
And already in svg.css :

svg:hover {
fill: orange;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question