CSS 背景图像溢出

问题描述 投票:0回答:1

我有一个背景,我试图用渐变覆盖,但渐变不够长或类似的东西

body {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    height: 100vh;
    margin: 0;
    padding: 0;
    background: linear-gradient(rgba(18, 16, 32, 0.8), rgba(20, 28, 58, 1)) no-repeat, url("imgs/Untitled-1.png") no-repeat;
    background-color: rgb(20, 28, 58);
    background-size: cover;
    background-position: center center;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

我尝试改变

background-position
但没有任何帮助

css background-image linear-gradients
1个回答
0
投票

带高度调节:100%;渐变延伸到覆盖整个视口高度。

body
 {
  ....

  height:100%;
 }
© www.soinside.com 2019 - 2024. All rights reserved.