繁体   English   中英

Repeat-y 对我不起作用。 图像没有按应有的方式重复

[英]Repeat-y is not working for me. The image is not repeating as it should

我在下面有一个简单的 html 代码

<body>
    <div class="wrapper">
        <div class="container">
            <div class="sky"></div>
            <img src="images/arcade-game.png" alt="">
        </div>
        
    </div>
</body>

这是我的 CSS 代码

.container{
    height:90vh;
    width:90vw;
    background-color: white;
    margin: auto auto;
    position: relative;
    overflow:hidden;
    
}

.sky{
    height: 100%;
    width: 100%;
    background-image: url(/images/sky.jpg);
    background-size: cover;
    background-repeat: repeat-y;
    animation: movingsky 4s linear infinite;

} 

我有 animation 让.sky向下移动,但是背景没有像我想要的那样重复。

我在这里遗漏了什么吗?

background-size: cover; 将拉伸图像以填充整个容器,因此看不到重复。 删除background-size或将其设置为固定大小。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM