سلام من حین hover کردن مشکلی که دارم اینه که نمیتونم svg رو recolor کنم باید چیکار کنم؟ ممنون
منظورت اینه که بعد از هاور رنگ به حالت اول برنمیگرده؟
کدت رو بذار تا بهتر متوجه بشیم
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
img:hover{
fill: white !important;
}
</style>
</head>
<body>
<img src="../Image/search.svg" alt="">
</body>
</html>
ببخشید وقتی که svg رو به صورت img وارد میکنم دیگه نمیتونم تغییر رنگش رو اعمال کنم ولی وقتی که تگ svg رو میدم میتونم.
خواستم بپرسم که svg رو همیشه باید به صورت تگ svg اعمال کنم یا با تگ img
شاید پاسخ شما همینجا باشد
خب اشکال همینجاس دیگه
پراپرتی fill برای تگ img جواب نمیده باید همون تگ svg رو بذاری
سلام باید اون fill رو برابر current-color بذارید و color رو مقدار رنگ مدنظرتون قرار بدید و با هاور کردن مقدار color رو تغییر بدید
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
/* Apply a default color to the parent element */
.parent-element {
color: blue; /* Change this to the default color you want */
}
/* Change the color of the SVG on hover */
.parent-element:hover circle {
color: red; /* Change this to the desired color on hover */
}
</style>
</head>
<body>
<div class="parent-element">
<svg width="100" height="100" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="currentColor" />
</svg>
</div>
</body>
</html>