我想让一个固定高度的CSS渐变背景淡入一种颜色但不重复渐变。CSS渐变背景不缩放,以一种颜色结束
html {
height: 50px;
margin: 0;
padding: 0;
background: yellow;
background: -webkit-linear-gradient(orange, yellow);
background: -o-linear-gradient(orange, yellow);
background: -moz-linear-gradient(orange, yellow);
background: linear-gradient(orange, yellow);
background-repeat: no-repeat;
}
我想要的梯度在指定的高度到另一端,然后有背景重复一种颜色。在codepen中,你可以看到渐变结束,但这是一个白色的背景;我想让背景变成黄色。我想完全在CSS中完成(不使用图像)。谢谢。
现在你可以放弃前缀。你也可以添加一个'background-color'并最终使用'background-size'来代替设置一个'height'。与'高度':https://codepen.io/gc-nomade/pen/VWRrrX与'背景大小'和没有'高度'https://codepen.io/gc-nomade/pen/owVoGp适用于HTML标签... –
@GCyrillus会在所有浏览器中添加bg颜色工作吗? – Qwerty
是的,如果您有任何旧浏览器可以看到后备工作,请在您有疑问时阅读规格并尝试使用笔中的代码段。线性渐变之前,用于设置渐变图像+ bgcolor(1px X 50px重复horizontaly;))请参阅https://developer.mozilla.org/en/docs/Web/CSS/background –