主要实现:1:上下左右居中;2:去掉滚动条!!!
没有废话,直接看代码!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>center</title>
<style>
*{
margin: 0;
padding: 0;
}
.deScroll{
}
::-webkit-scrollbar{
height: 0px;
width: 0px;
}
.box{
width: 600px;
height: 500px;
text-align: center;
background: yellow;
position: absolute;
top: calc(50% - 250px);
left: calc(50% - 300px);
}
.box span{
display: block;
width: 400px;
height: 300px;
margin-left: 100px;
margin-top: 100px;
background: url("xxx.jpg") no-repeat;
background-size: cover;
}
.box p{
}
.box1{
height: 300px;
background: red;
}
.box2{
height: 300px;
background: green;
}
</style>
</head>
<body class="deScroll">
<div class="box">
<span></span>
<p>随便打的一句话,啥都不代表</p>
</div>
<div class="box1"></div>
<div class="box2"></div>
<div class="box1"></div>
<div class="box2"></div>
<div class="box1"></div>
</body>
</html>
![O$%S{A_2]FFX2}9HP5TFCF.png