只使用一个渐变时,咱们能建立的图案并很少,当咱们把多个渐变图案组合起来,让他们透过彼此的透明区域显现时,神奇的事情就发生了!咱们首先想到的是把水平和水质条纹叠加起来,就能够获得各类各样的网格。css
1. 网格背景html
htmlcss3
<div class="stripe"></div>
cssspa
.stripe{ width: 250px; height: 150px; margin: 50px; background: linear-gradient(90deg,rgba(200,0,0,.5) 50%,transparent 0), linear-gradient(rgba(200,0,0,.5) 50%,transparent 0); background-size: 30px 30px; }
效果图code
2.波点背景htm
cssblog
.stripe{ width: 250px; height: 150px; margin: 50px; background-color: #655; background-image: radial-gradient(tan 30%,transparent 0); background-size: 30px 30px; }
效果图ip
固然,这个不是咱们想要的图案,其实,咱们能够生成两层圆点阵列图案,并把他们的背景定位错开,这样就能够获得真正的波点阵列了。it
cssio
.stripe{ width: 250px; height: 150px; margin: 50px; background-color: #655; background-image: radial-gradient(tan 30%,transparent 0), radial-gradient(tan 30%,transparent 0); background-size: 30px 30px; background-position: 0 0,15px 15px; }
效果图
3. 棋盘背景
css
.stripe{ width: 250px; height: 150px; margin: 50px; background-image: linear-gradient(45deg,rgba(0,0,0,.25) 25%,transparent 0,transparent 75%,rgba(0,0,0,.25) 0), linear-gradient(45deg,rgba(0,0,0,.25) 25%,transparent 0,transparent 75%,rgba(0,0,0,.25) 0); background-color: #eee; background-size: 30px 30px; background-position: 0 0,15px 15px; }
效果图
了解更多关于径向渐变https://www.w3cplus.com/content/css3-gradient