3
I have the following code:
body {
margin: 0;
padding: 0;
background: #885053;
}
#hide {
width: 100%;
height: 0px;
background: #fe5f55;
margin: 0 auto;
-webkit-animation: hideSlideDown 0.5s forwards;
animation: hideSlideDown 0.5s forwards;
}
#tudo {
width: 100%;
height: 500px;
background: red;
}
#headbar {
width: 100%;
height: 254px;
background: green;
}
#btnmenu {
position: absolute;
width: 100px;
height: 30px;
background: #FFF;
left: 50%;
top: 0%;
text-align: center;
border-radius: 0px 0px 10px 10px;
}
#btnmenu:hover{
-webkit-animation: slide 0.5s forwards;
animation: slide 0.5s forwards;
}
@-webkit-keyframes hideSlideDown {
from {
height: 0px;
}
to {
height: 265px;
}
}
@keyframes hideSlideDown {
from {
top: 0%;
}
to {
top: 45%;
}
}
@-webkit-keyframes slide {
from {
top: 0%;
}
to {
top: 45%;
}
}
@keyframes slide {
from {
top: 0%;
}
to {
top: 45%;
}
}
<div id="tudo">
<div id="head">
<div id="hide">
</div>
<div id="btnmenu">
<span>Menu</span>
</div>
<div id="headbar">
</div>
</div>
</div>
I’m trying to do the div #Hide follow the button to the center of the page by pointing to the button, but I don’t know what’s going wrong.
The div that is with height 0px is not appearing in the animation.
– Israel Sousa