如何解决线性渐变中的背景色条?

How to solve background color strips in linear-gradient?

我不想要图案,而是简单的线性渐变。

但是,通过使用以下代码,我得到了背景图案条。

body {
  background: linear-gradient( to top, #ffffff, #e6e6e6);
}

结帐:Screenshot

body {
  background: linear-gradient( to top, #ffffff, #e6e6e6);
  height: 100%;
  margin: 0;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

根据链接的问题,这会阻止背景重复并将图形的高度设置为 100%,因此它不仅仅是一行

您没有任何内容,也没有高度,这就是条纹的原因。添加高度或内容,即可。

html, body {
  height: 100%;
}
body {
  background: linear-gradient( to top, #ffffff, #e6e6e6);
}