欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
  代码如下:
 
  
 
  
 
  
 
  <!DOCTYPEhtml>
 
  <html>
 
  <head>
 
  <style>
 
  .mbl{
 
  width:20em;
 
  height:20em;
 
  background:url(image/girl.jpg);
 
  background-size:cover;
 
  overflow:hidden;
 
  margin:30px;
 
  }
 
  .text{
 
  width:18em;
 
  height:18em;
 
  margin:1em;
 
  background:hsla(0,0%,100%,.4);
 
  color:black;
 
  text-align:center;
 
  overflow:hidden;
 
  position:relative;
 
  }
 
  .text::before{
 
  position:absolute;
 
  background:url(image/girl.jpg);
 
  background-size:cover;
 
  top:0;
 
  right:0;
 
  bottom:0;
 
  left:0;
 
  content:'';
 
  filter:blur(4px);
 
  /*background:rgba(225,0,0,0.5);*/
 
  }
 
  .textp{
 
  height:inherit;
 
  width:inherit;
 
  display:table-cell;
 
  vertical-align:middle;
 
  position:relative;
 
  }
 
  </style>
 
  </head>
 
  <body>
 
  <divclass="mbl">
 
  <divclass="text">
 
  <p>图片上面的文字内容</p>
 
  </div>
 
  </div>
 
  </body>
 
  </html>

2345截图20181026141812.png2345截图20181026140821.png



本文转载自中文网

 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c56737.shtml