我正在为网页创建 CSS 样式表。我想要整个网页的渐变背景,但我不知道如何让渐变覆盖整个网页。现在,渐变采用典型横幅的形式,通过网站向下复制,就像一个“条”在另一个之上。
关于如何解决这个问题有什么想法吗?
我目前的代码:
body {
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #FBFF94), color-stop(1, #00A3EF));
}
最佳答案
使用 VH 单位,即垂直高度。
考虑
100vh = 100%.
body {
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #FBFF94), color-stop(1, #00A3EF));
height:100vh; /* vh = Vertical Height */
}
关于css - CSS 中带有渐变背景的不需要的重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29358781/