2016-11-16 120 views
0

我有一個div,在那裏我輸入了一張圖片,而我「位置:絕對」是另一個div,點擊時會將您帶到頁面底部。但是,當你縮小時,它會保持原位,但是當你縮小它時,會向下移動並離開圖像分隔。我在問,如何在放大和縮小瀏覽器時將內容保持在中心位置。我搜索了所有堆棧和其他網站,但找不到解決方案。如何在瀏覽器上放大和縮小時保持內容的位置

HTML

#pic-div { 
 
\t width: 100%; 
 
\t height: 700px; 
 
\t margin: 0 auto; 
 
\t overflow: hidden; 
 
} 
 
#pic-button { 
 
\t width: 100px; 
 
\t height: 100px; 
 
\t margin: 0 auto; 
 
} 
 
#down-button { 
 
\t max-width: 200px; 
 
\t max-height: 200px; 
 
\t background-color: black; 
 
\t border-style: none; 
 
\t color: white; 
 
\t font-family: 'Coiny', cursive; 
 
\t position: absolute; 
 
\t cursor: pointer; 
 
\t margin: 0 auto; 
 
\t margin-top: 500px; 
 
} 
 
#down-button:hover { 
 
\t background-color: grey; 
 
}
<div id="pic-div"> 
 
<div id="welcome-pic"> <img id="pic-welcome" src="luxpics/logobar.jpg"> 
 
    <div id="pic-button"> 
 
    <button id="down-button">LET'S START</button> 
 
    </div> 
 
</div> 
 
</div

回答

0

試試這個

#down-button { 
    max-width: 200px; 
    max-height: 200px; 
    background-color: black; 
    border-style: none; 
    color: white; 
    font-family: 'Coiny', cursive; 
    position: absolute; 
    cursor: pointer; 
    margin: 0 auto; 
    bottom: 25px; 
    //margin-top: 500px; 
} 
0

你可以嘗試使用位置:固定,而不是使用絕對?

+0

當我給它一個固定的位置,它使移動無處不在我滾動。 – Desole11

+0

將這些加在一起 ​​- position:fixed; bottom:0; right:0; – ross

相關問題