我想要一个方形按钮,以便在浏览器收缩时响应,但它不会移动。有什么问题?谢谢你的帮助!
<div class="firstSection">
<div class="menuBox"></div>
.firstSection {
background-image: url(/Users/omaramin/Documents/Competition/project/mainBanner.png);
background-repeat: no-repeat;
background-position: center;
position: absolute;
top:-144px;
width: 100%;
height: 100%;
font-family: Bariol;
color: #ffffff;
}
.menuBox {
position: relative;
margin-left: 200px;
margin-top: 200px;
width: 35px;
height: 35px;
border-style: solid;
border-width: 1px;
border-radius: 2px;
}
答案 0 :(得分:6)
您正在使用基于像素的定位,而是使用百分比。
.menuBox {
position: relative;
margin-left: 20%;
margin-top: 200px;
width: 35px;
height: 35px;
border-style: solid;
border-width: 1px;
border-radius: 2px;
}
希望这有帮助!