Change span color on div hover
12,676
Solution 1
You may try this (Updated Fiddle Example):
.slike_i_text div:hover span{
color:lightgreen;
}
Instead of this:
.slike_i_text div:hover .slike_i_text div span{
color:lightgreen;
}
Solution 2
You don't have to go like .slike_i_text div:hover .slike_i_text div span
instead you should use .slike_i_text div:hover span
.
fiddle here
Author by
Crion
Updated on June 09, 2022Comments
-
Crion almost 2 years
Sorry if this is stupid question but i really don't know what problem is.I am trying to change color of span on div's hover but my code doesn't seems to work.
Here is code i'am using:HTML
<div class="slike_i_text"> <a href="#"><div> <img align="left" src="wolf.jpg"/><span>Text 1</span></div></a> <a href="#"><div> <img align="left" src="wolf.jpg"/><span>Text 2</span></div></a> </div>
CSS
.slike_i_text div{ overflow: hidden; width:300px; margin-bottom: 10px; text-decoration: none; } .slike_i_text div img{ width:80px; height:80px; } .slike_i_text div span{ color: #6A6A6A; font-family: arial; font-size: 15px; font-weight: bold; } .slike_i_text a{ text-decoration: none; } .slike_i_text div:hover .slike_i_text div span{ color:lightgreen; }
You can find my fiddle here.