中间镂空的图片遮罩指的大概就是这样一个效果:

使用CSS实现中间镂空的图片遮罩效果

镂空一个洞的代码
CSS Code复制内容到剪贴板

  1. <div id="container" style="position: relative; margin: 550px 0 0 50px;">   
  2. <svg style="position: absolute;" width="400" height="280">   
  3. <defs>   
  4. <mask id="mask3">   
  5. <rect x="0" y="0" width="100%" height="100%" style="stroke:none; fill: #ccc"></rect>   
  6. <circle id="circle1" cx="100" cy="100" r="50" style="fill: #000" />   
  7. </mask>   
  8. </defs>   
  9. <rect x="0" y="0" width="100%" height="100%" style="stroke: none; fill: #ccc; mask: url(#mask3)"></rect>   
  10. </svg>   
  11. <img src="http://img6.cache.netease.com/cnews/2014/11/3/20141103100737855b7.jpg" />   
  12. </div>  

镂空多个洞的代码

CSS Code复制内容到剪贴板
  1. <div id="container" style="position: relative;">   
  2. <svg style="position: absolute;" width="400" height="280">   
  3. <defs>   
  4. <mask id="mask3">   
  5. <rect x="0" y="0" width="100%" height="100%" style="stroke:none; fill: #ccc"></rect>   
  6. <circle id="circle1" cx="100" cy="50" r="50" style="fill: #000" />   
  7. <circle id="circle1" cx="300" cy="100" r="50" style="fill: #000" />   
  8. <circle id="circle1" cx="100" cy="200" r="50" style="fill: #000" />   
  9. </mask>   
  10. </defs>   
  11. <rect x="0" y="0" width="100%" height="100%" style="stroke: none; fill: #ccc; mask: url(#mask3)"></rect>   
  12. </svg>   
  13. <img src="http://img6.cache.netease.com/cnews/2014/11/3/20141103100737855b7.jpg" />   
  14. </div>  

 

CSS3 版

用 box-shadow ,代码如下:

CSS Code复制内容到剪贴板
  1. position: fixed;   
  2. left: 150px;   
  3. top: 35px;   
  4. width: 100px;   
  5. height: 100px;   
  6. border-radius: 100px;   
  7. box-shadow: rgba(0,0,0,.8) 0px 0px 0px 2005px;   
  8. z-index: 100;  

缺点是只能镂空一个洞。

 

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。