z-index层级顺序 opacity透明度 display: none 模态框实现

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
     <div style=" display: none; z-index: 10; position: fixed; top: 50%; left:50%; margin-top:-200px; margin-left: -250px; background-color: white;height: 400px; width: 500px;

     "></div>
    <div style=" display: none; z-index:9; position: fixed; background-color: black;
     top:0;
     left:0;
     bottom:0;
     right:0;
     opacity: 0.5; "></div>
    <div style="height: 5000px; background-color: greenyellow">
        sdada
    </div>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/my-love-is-python/p/9291320.html