我正在做一個簡單的網站。 在這個網站上,我有幾個div在不同的層次(一個在另一個之前等)。 在後面的兩個div沒有問題,但是當我調整瀏覽器的大小時,前面的div會移動,我不希望這樣。 奇怪的是,後面的div是以相同的方式創建的。 因此,基本上我的網頁左右是:#icone_esquerda和#icone_direita。 下面是我的代碼:瀏覽器調整大小時正面div移動
<style type="text/css">
#fundo{
background-image:url("tileable_wood_texture_copy.png");
background-repeat:repeat;
position:fixed;
width:100%;
height:100%;
top:0;
left:0;
}
#frente{
background-image:url("luinguica.png");
background-repeat:no-repeat;
background-position:top center;
position:fixed;
width:inherit;
height:inherit;
left: 0;
top: 0;
z-index:50;
}
#icone_esquerda{
background-image: url("botao_facebook.png");
background-position: bottom center;
background-repeat: no-repeat;
height: 50px;
left: 45%;
margin: -25px 0 0 -25px;
position: fixed;
top: 45%;
width: 50px;
z-index: 60;
}
#icone_direita{
background-image: url("botao_mail.png");
background-position: bottom center;
background-repeat: no-repeat;
position: fixed;
width: 50px;
height: 50px;
left: 53%;
top: 45%;
margin: -25px 0 0 -25px;
z-index: 60;
}
</style>
</head>
<body>
<div id="fundo">
<div id="frente">
<a href="http://www.facebook.com/confrariadaempada">
<div id="icone_esquerda">
</div>
</a>
<a href="mailto:[email protected]">
<div id="icone_direita">
</div>
</a>
</div>
</div>
</body>
當我調整瀏覽器的div與IDS icone_esquerda和icone_direita移動! 任何人都可以幫助我嗎?
在此先感謝。
移動到什麼意義上?嘗試在[小提琴](http://www.jsfiddle.net)中複製您的問題。 – Terry 2013-04-30 00:01:40
從我在這裏看到的,如果你使用%值,它是正常的,因爲他們的父母div的大小與窗口寬度 – 2013-04-30 00:10:35