body { background-image: linear-gradient(to bottom, rgba(0,0,0, 0.1), rgba(0,0,0, 1)), url(img/bg.jpg); background-size: cover; background-repeat: no-repeat; background-position: center center; }
这样的 css3 可以把 background-image
分开写吗?
比如,覆盖 body 规则,同时又保留 linear-gradient
body.cover { background-image: url(img/other.jpg); /* 同时保留 linear-gradient(to bottom, rgba(0,0,0, 0.1), rgba(0,0,0, 1)) */ }
![]() | 1 abelyao 2015-04-24 16:55:55 +08:00 body.cover 的 background-image 属性会覆盖 body 的,所以 linear-gradient 部分应该也会没了吧 |
![]() | 2 zythum 2015-04-24 18:33:02 +08:00 对不起。不行。 |
![]() | 3 iyangyuan 2015-04-24 19:58:19 +08:00 via iPhone over的时候也加上渐变不就行了? |