html - 动画对齐
问题描述
我正在动画我的模态以在被调用时缩放和缩放。我已将其设置为在中心对齐,但动画从屏幕的右下角开始,然后移动到中心。codepen 以便更好地理解
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
@keyframes animatezoom {
from {transform: scale(0)}
to {transform: scale(1)}
}
解决方案
只需从类中删除、top
和属性并更改. 所以你的CSS看起来像这样:left
position
transform
login-modal-content
margin: auto
login-modal-content
.login-modal-content {
font-family: 'Segoe UI';
text-align: center;
border:none;
background: #3e3e3f;
border-radius: 20px;
color:#ffff;
width: 35%; /* Could be more or less, depending on screen size */
margin: auto;
}
您已经将父母定位为中心,因此不必也定位孩子absolute
。它是相对于其父级的。
推荐阅读
- r - 循环中向量元素的索引 - R
- html - 100vh 部分与移动设备上的另一个 100vh 部分重叠
- python - 聚合后排序和选择(熊猫)
- objective-c - 无法构建 Objective-C 模块“ContactsUI”
- python - 如何将绘制在不同图形上的图像保存到 matplotlib 中的不同位置?
- firefox - VueJS - DOMException:“操作不安全。”
- regex - 从 googlemaps JSON 响应中提取值
- python - 使用范围打印 [100, 1000, 10000]
- android - adb shell "screencap -p /sdcard/screen.png" 失败并显示“设备上没有剩余空间”,但有足够的空间
- javascript - 单击按钮显示新组件