放大背景图像的效果

  • 本文关键字:图像 背景 放大 css
  • 更新时间 :
  • 英文 :


这是一个网站的链接http://newworldorder.com/,每当我加载页面时,我都会看到背景放大大约2秒,有可能用css实现这一点吗?如果是,我该怎么做?

也许是这样的?尽管如此,它在最后重置为1x比例。

<style>
div {
background-image: url("https://images.unsplash.com/photo-1547898812-9e25c5a693e0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1936&q=80");
background-repeat:no-repeat;
background-attachment:fixed;
background-size:cover;
background-position:center-top;
background-position-x: 50%;
background-position-y: 0%;
-webkit-animation: zoomin 5s 1;
}
@-webkit-keyframes zoomin {
0% {
-webkit-transform: scale(1);
}
100% {
-webkit-transform: scale(1.1);
}
}
</style>
<body>
<div style="position:absolute;top:0;bottom:0;left:0;right:0;"></div>
</body>

我不知道你到底在问什么,但这可能是你想要的:

html, body {
background: url("http://placehold.it/200x200") top center no-repeat;
animation: animateBg forwards 2s ease-in;
}
@keyframes animateBg{
from { background-size: 200px; }
to { background-size: 100%; }
}

最新更新