<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
html,body,#mask{
height: 100%;
margin: 0;
}
#mask{
width: 100%;
background: black;
opacity: 0.3;
position: absolute;
}
#confirm{
width: 300px;
height: 200px;
position: absolute;
background: red;
border-radius: 5px;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
</style>
</head>
<body>
<div id="mask">
</div>
<div id="confirm">
</div>
</body>
</html>
纯 CSS 让弹出层居中显示
最新推荐文章于 2022-10-14 00:51:01 发布