css实现网格背景

摘要:
1.网格背景html<divclass=“stripe”>&书信电报;150像素;背景:}渲染2。波点背景css。stripe{width:css.tripe{width:transparent0),径向梯度(tan30%,背景位置:}渲染3。棋盘背景css。条纹{width:height:margin:

只使用一个渐变时,我们能创建的图案并不多,当我们把多个渐变图案组合起来,让他们透过彼此的透明区域显现时,神奇的事情就发生了!我们首先想到的是把水平和水质条纹叠加起来,就可以得到各种各样的网格。

1. 网格背景

html

<div class="stripe"></div>

css

.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;
}

效果图

css实现网格背景第1张

2.波点背景

css

.stripe{
  width: 250px;
  height: 150px;
  margin: 50px;
  background-color: #655;
  background-image: radial-gradient(tan 30%,transparent 0);
  background-size: 30px 30px;
}

效果图

css实现网格背景第2张

当然,这个不是我们想要的图案,其实,我们可以生成两层圆点阵列图案,并把他们的背景定位错开,这样就可以得到真正的波点阵列了。

css

.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;
}

效果图

css实现网格背景第3张

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;
}

效果图

css实现网格背景第4张

了解更多关于径向渐变https://www.w3cplus.com/content/css3-gradient

免责声明:文章转载自《css实现网格背景》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇[转]C# PowerPoint操作的基本用法JS获取照片拍摄的角度属性,用于旋转控制下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Jquery Mobile日期控件mobiscroll

1.日期控件 参考:http://www.cnblogs.com/hxling/archive/2012/12/12/2814207.html http://www.wglong.com/main/artical!details?id=11 <link href="css/mobiscroll.custom-2.5.0.min.css" rel="s...

css实现平行四边形、菱形图片效果

一、平行四边形 1. 使用两个元素实现 html <a class="button"> <div>click me</div> </a> css .button{ margin: 50px; display: inline-block; background: #404ED3; trans...

html中删除表格的一行(有弹窗)

html中删除表格一行其实很简单,但是加上一个提示弹窗后,点击确定后却获取不到要删除的是哪一行,下面是一个demo html: <tr> <td> <input type="checkbox" /> </td> <td>安...

JS拖动滑块验证

使用这种验证方法的目的:证明当前的用户不是机器人~防止恶意操作。 实现思路:   1、获取silde滑块(获取元素)   2、为元素注册事件———鼠标点击事件(onmousedown)鼠标点击之后获得当前鼠标的X坐标。   3、如何获取到鼠标的x坐标——使用clientX事件(当事件被触发时,鼠标指针的水平坐标)。   4、鼠标移动事件发生后根据从最开始点...

JS之滚动条效果2

在前面一篇说的是滚动条效果,本篇继续在前面的基础上面针对滚动条进行操作。本次要实现的效果如下:拖动滚动条左右移动时,上面的图片内容也相对外层盒子做相对移动。 下面针对要实现的效果进行分析:首先是页面基础结构,要实现内容的相对移动,里面的内容需要针对外层盒子相对定位,宽度应该大于外层盒子,而且外层盒子应该超出隐藏。下面是一个滚动条,由底层和滚动两部分组成。...

页面嵌入QQ功能(点QQ建立一个临时会话,显示在页面的固定位置)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><...