<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>html、css自定义实现模态框遮罩层</title>
<style>
html,body {
width: 100%;
height: 100%;
margin: 0;
}
body {
position: relative;
}
#overlay {
width: 100%;
height: 100%;
position: absolute;
top: 0;
background: rgba(0, 0, 0, 0.3);
z-index: 9999;
display: none;
}
.overlay-modal {
position: absolute;
width: 300px;
height: 200px;
left: 50%;
top: 50%;
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
border-radius: 6px;
text-align: center;
margin-left: -150px;
margin-top: -100px
css 实现自定义遮罩层模态框
最新推荐文章于 2025-05-26 12:10:32 发布