我目前正在尝试制作带有欢迎信息的动画。我希望它被放置在我的 div 的垂直中间。我将它从大字体转换为小字体,似乎大字体高度仍在影响定位还是我错了?
#barbar{
height:10%;
width: 100%;
background-color:rgba(79, 79, 90, 0.92);
bottom: 0;
position: fixed;
z-index: 3;
}
.hello{
color: black;
font-family: "Times New Roman";
text-align: center;
animation: ease;
animation-name: gas;
animation-iteration-count: 1;
animation-fill-mode: forwards;
animation-duration:2s;
position: fixed;
font-size: 100px;
bottom: 700px;
margin-left: -20%;
white-space: nowrap;
}
@keyframes gas{
from { font-size: 500px; bottom: 700px; margin-left: -20%;}
to { font-size: 12px; bottom: 0; margin-left: 15%;}
}
<div id = "barbar">
<h3 class ='hello'> Welocme User </h3>
</div>
正如你所看到的,我h3在 div 内,但它仍然没有以某种方式最终到达我想要放置的位置。to bottom:-x%不是我正在寻找的解决方案。