Blogger Information
Blog 49
fans 0
comment 4
visits 41707
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
绝对定位实现窗口遮罩功能(时间:2019年1月17日)
过儿的博客
Original
650 people have browsed it

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <link rel="stylesheet" href="/css/demo-1503.css">

    <title>绝对定位实现遮罩</title>

</head>

<body>

    <div class="shade"></div>

    <div class="login"><img src="static/images/1.jpg"></div>

</body>

</html>



以下是样式文件:

body{

    margin:0;

    background-image: url(/static/images/3.png);

    background-size: cover;

}


.shade{

    position: absolute;

    left: 0;

    top: 0;

    width: 100%;

    height:100%;

    background-color: black;

    opacity: 0.7;

}

.login{

    background-color: white;

    position: absolute;

    left: 50%;

    top:50%;

    margin-left: -150px;

    margin-top:-50px;

}

.login img{

    width: 300px;

}

QQ图片20190117120816.png


重点:1、对于遮罩层,应该单独设置背景;

          2、底层利用opacity设置显示明亮度;

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post