EmilySeville7cfg
New member
Hello! Now I have the following index.html, style.css, image.svg respectively:
I don't understand how to make my .svg change colors when I hover mouse on it.
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class='clickable' onclick="alert('.svg clicked')">
<object data="image.svg"></object>
</div>
</body>
</html>
CSS:
.clickable {
width: 100px;
height: 100px;
border-radius: 50%;
overflow: hidden;
}
object {
width: 100%;
pointer-events: none;
}
Code:
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="100" height="100">
<style type="text/css">
<![CDATA[
circle:hover {
stroke: #006600;
fill: #00cc00;
}
]]>
</style>
<circle cx="50" cy="50" r="50"/>
</svg>
I don't understand how to make my .svg change colors when I hover mouse on it.