【小知识点】根据文字数量的多少调整样式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
.mask{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
}
.box{
width: 200px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -100px;
background: #fff;
text-align: center;
}
p{
padding: 10px;
text-align: left;
display: inline-block;
}
</style>
</head>
<body>
<div class="mask">
<div class="box">
<p>之前在很多地方看到之前在很多地方看到之前在很多地方看到</p>
</div>
</div>
</body>
</html>
效果图如下:



浙公网安备 33010602011771号