<div class="wrap">
<div class="btn">Кнопка
<div class="btn__subcontent">
Бомжи и масло
</div></div>
</div>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: sans-serif;
}
.wrap {
display: flex;
width: 100%;
height: 100vh;
align-items: center;
justify-content: center;
align-items: center;
justify-content: center;
}
.btn {
position: relative;
display: flex;
width: 300px;
height: 100px;
background-color: red;
align-items: center;
justify-content: center;
font-size: 32px;
color: white;
cursor: pointer;
}
.btn__subcontent {
position: absolute;
width: 100%;
top: 100%;
left: 0;
display: flex;
padding: 16px;
background-color: green;
align-items: center;
justify-content: center;
font-size: 32px;
color: white;
opacity: 0;
pointer-events: none;
transition: 2s; /* Тут ставим чтобы пропадало не сразу */
}
.btn:hover .btn__subcontent{
animation: qwerty 2s forwards;
/* forwards останавливает анимацию на последнем кадре */
pointer-events: none;
}
@keyframes qwerty {
0% {
opacity: 0;
}
25% {
opacity: 0;
}
100% {
opacity: 1;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.