如何在css3中设置线性渐变背景的位置

时间:2014-08-25 10:27:55

标签: html css3

我正在尝试使用图像设置body标签的线性背景的位置(即顶部的边距或填充)。

我的代码是:

background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0), rgba(0, 0, 0, 0.9), rgb(0, 0, 0)), url("g2hd.jpg");
background-repeat: repeat, no-repeat;
background-attachment: fixed; background-position: 0% 30px, center center; 

但30px无效,但它适用于background-image:url("g2hd.jpg");

的正常情况

有什么想法吗?

我得到了自己的回答

多个背景图像:每个图像都匹配 相应的位置样式,从第一个指定到最后一个。

参考:https://developer.mozilla.org/en-US/docs/Web/CSS/background-position

0 个答案:

没有答案