2014-01-27 73 views
0

我想要一个方形按钮,当浏览器缩小但它没有移动时作出响应。有什么问题?谢谢您的帮助!对象没有响应位置:相对

<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

哪一个是按钮?如何JSFiddle? – Yani

回答

5

您正在使用基于像素的定位,请使用百分比代替。

.menuBox { 
    position: relative; 
    margin-left: 20%; 
    margin-top: 200px; 
    width: 35px; 
    height: 35px; 
    border-style: solid; 
    border-width: 1px; 
    border-radius: 2px; 
} 

希望这有助于!

+0

它做到了!非常感谢!我可以在7分钟内给你绿色箭头 – user2605157

+1

@ user2605157很高兴能帮到你!我爱绿色箭头! :) – Yani