我有一個固定寬度爲960px的主包裝。在頂部和右側有一個登錄按鈕。通過按下此按鈕,它將直接在主包裝的正下方打開一個div層。因此我使用z-index:1.問題是我不知道如何根據主包裝器而不是瀏覽器窗口寬度設置固定位置。現在當設置左/右位置時,div將根據整個瀏覽器窗口的寬度進行放置。如果分辨率較高,則主包裝被置於0自動。如何放置z-index div?
來舉個例子:
代碼:
#main {
width:300px;
height: 500px;
background-color: #f23;
margin: 0 auto;
}
#zindex{
font-size: 11px;
width: 50px;
height: 50px;
background-color: #dedede;
position: absolute;
right: 0;--> will place the div depending from the browser window and not main
}
,如果有一個人誰可以告訴我如何解決這個我真的感激。