如何修复重复的线性渐变

时间:2019-08-08 11:10:31

标签: css linear-gradients

我一直试图阻止线性渐变重复进行,我的代码似乎正确,但是我缺少一些东西。由于某种原因,即使使用no-repeat标签,它也会不断重复自身。感谢您的浏览!

我试图将html标签添加到css中,添加了background-size:cover,...

body,
html {
  font-size: 95%;
  text-align: center;
  background: linear-gradient(360deg, #1C1C1C 10%, #494949 360%), no-repeat;
  background-size: cover;
}

1 个答案:

答案 0 :(得分:0)

html {
  font-size: 95%;
  text-align: center;
  background: linear-gradient(360deg, #1C1C1C 10%, #494949 360%) no-repeat;
  background-size: cover;
  height:100%;
}
<body>
  <h1>test</h1>
</body>

,删除no-repeat并立即尝试之前,还有,

body ,html{
        font-size: 95%;
        text-align: center;
        background: linear-gradient(360deg, #1C1C1C 10%, #494949 360%) no-repeat;
        background-size: cover;

    }