Skip to content Skip to sidebar Skip to footer

Animating An Element When Hovering On Two Other Element Using Css

i am trying to animate a div when hovering on another div. Ihave following code html
css div { height: 100px;

Solution 1:

You need to wrap the content in the div and use a child selector. Note I gave the larger div an id as well. Here is the css:

JS Fiddle

#box {
    height: 100px;
    width: 100px;
    background: red;
    position: absolute;
    transition: all 0.4s ease-in-out;
}
#content {
    width: 20px;
    background: green;
    height: 0;
    transition: all 0.4s ease-in-out;
    position: margin-top: -100px;
    margin-left: 50px;
    -webkit-transition: all .8s ease;
    -moz-transition: all .8s ease;
    -ms-transition: all .8s ease;
    -o-transition: all .8s ease;
    transition: all .8s ease;
}
#box:hover > #content {
    height: 20px;
}

Post a Comment for "Animating An Element When Hovering On Two Other Element Using Css"