我试过clear:both
,box-sizing:border-box
,但都是一样的,在正常窗口中没有问题,但在调整浏览器窗口大小后,收到了这个错误,div->;按钮与div重叠->;H1
null
.button {
position: absolute;
top: 60%;
left: 50%;
transform: translate(-50%, -50%);
}
.btn {
margin-top: 1000px;
border: 1px solid white;
padding: 10px 30px;
color: white;
text-decoration: none;
box-sizing: border-box;
}
.btn:hover {
background-color: white;
color: black;
transition: 0.6s ease;
}
<div class="title">
<h1>Demo Production</h1>
</div>
<div class="button">
<a href="" class="btn">Watch Video</a>
<a href="" class="btn">Learn More</a>
</div>
null
这看起来像是Flexbox的工作。参见cs-tricks.com