实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>遮罩效果</title> <style> body{ margin: 0; background: url(images/php.png); background-size: cover; background-repeat: no-repeat; } .box{ position: absolute; width: 100%; height: 100%; left: 0; top: 0; background: black; opacity: 0.7; } .login{ position: absolute; top:50%; left: 50%; margin-left:-170px; margin-top:-210px; } .login img{ width: 340px; height: 420px; } </style> </head> <body> <div class="box"></div> <div class="login"> <img src="images/login.png" alt=""> </div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例
网站实现简单的模拟遮罩效果。