How can I select a div
when I hover a child h1
with css3 only.
I want the div
to have a animated opacity:0
, done with keyframes. I can do the keyframes part by myself. Just need help with the selection.
How can I select a div
when I hover a child h1
with css3 only.
I want the div
to have a animated opacity:0
, done with keyframes. I can do the keyframes part by myself. Just need help with the selection.
Ho ho .... the thing that you are asking is known as JS dom manipulation. For that a language is developed -- JavaScript. Any selection of HTML element and further manipulation is out of scope of CSS. It is only for styling and not for node manipulation dear!
Try out jQuery with .parentsUntil selector and your problem will be solved. Also, there is no such selector which would turn heel from end element to go to parent by CSS only. Though with SASS/LESS there may be some possibliites. But only CSS3 -- Nil, ie 0.
Does something simple like that work as you wish?
.wrapper{
background:red;
transition: opacity 1s ease-in-out;
}
.header:hover {
opacity: 0.5;
}
<div class="wrapper"><h1 class="header">Title</h1></div>