灰色部分出现在底部

时间:2013-12-15 18:12:52

标签: html css3 linear-gradients

我正在建立一个社交网络,我正在使用linear-gradient(#dadae3, white)。这样可行,但底部的颜色为#dadae3的部分显示在底部。我没有这个部分的元素。

截图:

enter image description here

我正在寻找摆脱这个灰色部分的解决方案。谢谢!

2 个答案:

答案 0 :(得分:1)

你的背景渐变只是在那里重复,因为body元素的 height (我假设你在body元素上使用渐变),还要确保您已将background-repeat设置为no-repeat

Demo

html, body {
   height: 100%; /* Setting both the elements height to 100% */
}

body {
    background-repeat: no-repeat; 
    /* mmmm not required as we have set to fixed but than too no harm using it */
    background-attachment: fixed; /* Fixes background for you */
    background: linear-gradient(#dadae3, white);
}

答案 1 :(得分:0)

可能是页面的background-colorbody元素的html

渐变只是覆盖页面中的div!检查css是否为body或html(或此元素的父级)。

您可能还想查看footer CSS属性!

请尝试检查:

html, body, footer {
  background-color: transparent; // remove the background..
}
相关问题