老师这样写 符合要求吗?
来源:2-12 自由编程
TheRoo
2021-07-02 09:53:57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
.container {
width: 100%;
height: 667px;
background-color: gray;
}
.inner {
width: 50%;
background-color: #fff;
border-radius: 5px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.inner p {
font-size: 25px;
display: inline-block;
width: 100%;
height: 80px;
line-height: 80px;
text-align: center;
}
.inner .btn-container {
width: 100%;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
margin: 20px auto;
}
button {
width: 100px;
font-size: 20px;
color: white;
border-radius: 5px;
text-align: center;
line-height: 50px;
}
.btn1 {
background-color: blue;
margin-right: 20px;
}
.btn2 {
background-color: gray;
opacity: 0.8;
}
</style>
</head>
<body>
<div class="container">
<div class="inner">
<p>确认要删除吗?</p>
<div class="btn-container">
<button class="btn1">确认</button>
<button class="btn2">取消</button>
</div>
</div>
</div>
</body>
</html>
1回答
好帮手慕言
2021-07-02
同学你好,参考下方:
1、外层大盒子设置一个半透明的背景色 ,高度不建议设置成固定值,可以设置为百分比,如下:
2、内层盒子的样式可以再调整一下,让效果更美观,代码参考:
祝学习愉快~
相似问题