Multiple Effects On Single Div Element Hover
I am trying to get multiple effects on a single image hover to allow the best outcome with the least code possible. Note: I do not want jquery at all! CSS only (even 3). So I have
Solution 1:
Css does not contains parent navigation selectors... Only descendant and following sibilings.
Since the .container
div is a sibiling to the .image
div, you could set the :hover
pseudo to the div instead to the anchor:
.image:hover ~ .container {
background-image: url('logo-tp-text.png');
}
As ~
is a general sibiling selector.
More info here: MDN General sibiling selector
Also
If the html markup stays the same as you showed, I mean, if the .container
remains as a immediate followed sibiling to the .image
div, you can also use an Adjacent Sibiling Selector
.image:hover + .container {
background-image: url('logo-tp-text.png');
}
Post a Comment for "Multiple Effects On Single Div Element Hover"