2014-05-08 50 views
-4

我想知道如何让渐变背景在定义的布局外重复。CSS重复渐变背景

http://i.imgur.com/CYk2FiE.png

所需重复水绿色和橙色,这也是梯度。

谢谢。

+0

不是渐变带的只是一些元素(如DIV)横跨整个页面?如果是这样,你可以使用适当的颜色停止线性渐变。 –

+0

需要在黑色(右侧和左侧)外部重复任何分辨率的部分。 – user8414

回答

0
<body> 
    <div id="header" style="width:1316px;height:80px;"> 
     <div style="width:150px;height:72px;background-color:white;float:left;">repeat</div> 
     <div id="header-internal" style="background-color:gray;float:left;"> 
      1016px 
     </div> 
     <div style="background-color:white;width:150px;height:72px;float:left;">repeat</div> 
    </div> 
    <div id="content"> 
     what repeat background header left and right? two colors different? 
    </div> 
    <div id="footer"> 
     footer 
    </div> 
    <br /> <br /> <br /> 
    Should look like: 
    <img src="http://i.stack.imgur.com/KCbiK.png" /> 
</body> 

和CSS将

body { 
    margin:0; 
    padding:0; 
} 
#header { 
    background:url("http://s10.postimg.org/jfhegkq49/bg_center.jpg") no-repeat; 
    background-position: bottom center; 
    background-color: #EFEFEF; 
background-size:100%; 
    height: 80px; 
} 

#header-internal{ 
    margin: 0 auto; 
    height: 72px; 
    width: 1015px; 
} 

#footer { 
    background-color: red; 
    height: 80px; 
    margin-top:20px; 
} 
+0

例如我的问题:http://jsfiddle.net/srCN7/ – user8414

+0

编辑我的答案,试试这个 – loli