2017-06-24 134 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