【发布时间】:2022-01-19 01:44:45
【问题描述】:
需要帮助! 我需要滑入整个 div texte1 而不移动里面的内容(h2 和 p)。 我尝试在 div 上使用蒙版动画,但它不起作用。 请有任何建议!
<div class="container">
<div class="texte1">
<h2>This is a title</h2>
<p> This is a simple text animation This is a simple text animation This is a simple text animation This is a simple text animation This is a simple text animation This is a simple text animation</p>
</div>
</div>
.container {
border:1px solid red;
width:800px;
height:200px;
}
.texte1 {
animation: slidein 1s ease-in;
animation-fill-mode: forwards;
overflow:hidden;
border:1px solid green;
}
@keyframes slidein {
from {
width: 0px;
}
to {
width: 100%;
}
}
【问题讨论】:
-
您能多描述一下这里的“不动”是什么意思吗?您是否希望整个 div 以适当的宽度滑入 - 即您不会让文本从几行移动到更少的行?