滚动div背景css网格线

时间:2015-09-15 11:08:12

标签: css gradient gridlines

我正在尝试为滚动div创建一个背景网格,其中网格框具有动态大小。

如果背景附加到正文,这可以正常工作,但当附加到带溢出的div时,相同的背景仍然是固定的:滚动。

#content{
  background-image: linear-gradient(0deg, transparent 24%, 
                   rgba(255, 255, 255, .05) 25%, 
                   rgba(255, 255, 255, .05) 26%, 
                   transparent 27%,
                   transparent 74%,
                   rgba(255, 255, 255, .05) 75%, 
                   rgba(255, 255, 255, .05) 76%,   
                    transparent 77%, transparent),  
 linear-gradient(90deg, transparent 24%, rgba(255, 255, 255, .05) 25%, 
                  rgba(255, 255, 255, .05) 26%, 
                  transparent 27%, 
                  transparent 74%, 
                  rgba(255, 255, 255, .05) 75%, 
                  rgba(255, 255, 255, .05) 76%, 
                  transparent 77%, transparent);
  height:300px;
  background-size:50px 50px;
  overflow: scroll;
}

http://codepen.io/anon/pen/qOboBp

0 个答案:

没有答案