html - 需要一直创建到div

标签 html css

我打算做一个这样的网站http://watcherboost.com/

所以我想为我的网站创建中间菜单。所以我需要创建一个 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:	 #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:	 #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:	 #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>

我想让最后一个 div (id =middle) 像上层网站一样始终处于顶部模式。 但不幸的是我的 div (id=middle) 没有显示页面..

请指教如何编辑此代码 谢谢

最佳答案

您的 div 没有显示,因为它不包含任何内容。将 height 属性添加到其内联 CSS。

关于html - 需要一直创建到div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39557848/

相关文章:

html - Bootstrap 侧导航栏固定

html - Android webview单选按钮和复选框样式

html - div中真正的透明空间。没有文字,只有背景可见

JQuery 无法添加 css 类

css - 我需要这个 :nth:child equations

html - 是否可以在 UIWebView( native 应用程序)和 safari 之间共享 locastorage 数据?

php 登录仪表板在 Chrome 中显示数据泄露警报

javascript - 如何在响应式网站中创建连接两个图像的线?

css - 鼠标离开目标时背景过渡闪烁

HTML:char 的 sibling ▼