2017-06-24 135 views
0

進出口創造了德國一個網站,並有對方如家堆的按鈕當我把它設置到位置問題:絕對的或固定的。但是,當我把它設置爲相對的,它的作品。有人能解釋我嗎?按鈕堆疊在一起?

CSS文件:

#top { 
    display: inline-block; 
    width: 352px; 
    height: 160px; 
    color : white; 
    background-color: #2D2D2D; 
    float: left; 
    font-family: century gothic; 
    font-size: 25px; 
    border: none; 
    margin: 0px; 
    position: fixed 
    } 

和HTML文件:

<nav> 
<a class="weiter" href="Home.html"><button id="top" >Home</button></a> 
<a class="weiter" href="ueberuns.html"> 
<button id="top">&Uuml;beruns</button></a> 
<a class="weiter"><button id="top" id="click">Mitglieder</button></a> 
<a class="weiter" href="gebiet.html"><button 
id="top">UnserGebiet</button></a> 
<a class="weiter" href="kontakt.html"><button id="top">Kontakt</button></a> 
</nav> 
+0

能否請您爲我們提供了兩種結果的截圖? – Aenadon

回答

0

絕對位置並固定兩者使用DOM作爲參考例如在屏幕的左上角和作爲用於顯示的最高優先級處理。因此您分配的最後一個「頂級」課程將位於頂部。如果您爲其中一個按鈕指定另一個ID並使用定向CSS指令:

#Bottom{right:100px;} 

您將看到div開始移開。

因此,在總結固定和絕對的治療分配的所有項目作爲重中之重的HTML的順序,並將其移動到屏幕的左上角。

+0

感謝您的意見,我意識到這一點! – GoS