2016-09-18 17 views
0

我要作出這樣http://watcherboost.com/需要時刻創造的div

SO一個網站,我想爲我的website.so創建中間的菜單我需要創建一個div標籤,其始終是頭等在以下背景:

這是我試圖

<form id="form1" runat="server"> 
 
    <div> 
 

 
    <div id="top" style="background-color:#072530; height: 30px;margin-top: -10px;margin-left:auto;margin-right:initial"> 
 

 
    </div> 
 

 
    </div> 
 
</form> 
 
<div style="height: 300px;background-color: \t #0E5D7B; margin-top: 0px;"> 
 
</div> 
 

 
<div style="background-color:#072530; height: 30px;margin-top: -10px;margin-left:auto;margin-right:initial"> 
 

 
</div> 
 

 
<div style="height: 650px; background-color: \t #C2C2C2; margin-top: 0px;"> 
 
</div> 
 
<div style="background-color:#072530; height: 30px;margin-top: -10px;margin-left:auto;margin-right:initial"> 
 

 
</div> 
 
<div style="height: 300px;background-color: \t #0E5D7B; margin-top: 0px;"> 
 
</div> 
 
<div style="background-color:#072530; height: 30px;margin-top: -10px;margin-left:auto;margin-right:initial"> 
 

 
</div> 
 

 
<div id="middle" style="margin-left: 150px;margin-right:150px;margin-top:-250px;background-color:black"></div>

代碼我想這最後d iv(id = middle)永遠處於頂級模式,如上級網站。 但不幸的是我的div(ID =中)不顯示網頁..

請指點如何修改這個代碼 感謝

回答

0

您的DIV沒有顯示出來,因爲它不包含任何內容。將height屬性添加到其內聯CSS。

+0

感謝你對你的代碼的權利 – Prabath

0

如果你想在上面一個div住宿,你應該設置:

position:fixed; 
top:0px; 

試試這個:

https://jsfiddle.net/TiG3R/ug4vvo48/

+0

您好感謝。你能告訴我如何讓這個div中心... – Prabath

+0

你想要所有的導航欄在中心或導航欄文本? –

+0

我要把導航欄和其他東西在這個div,所以首先我想要中心這個div – Prabath