html - 导航中的类仅适用于 firefox 中的检查元素

标签 html css firefox navbar nav

我想为我的网站编写一个导航栏。它应该支持移动和桌面 View 。现在我想在 nav 中添加一个 div 但它不起作用,但是当我使用 firefox 中的检查元素分析它并刷新它工作的站点时。谁能帮帮我?

这是导航的代码片段:

/* Here is the css declaration of the drop class: */

.drop {
  width: 50px;
  height: 50px;
  background-color: #FFFFFF;
  cursor: pointer;
  display: block;
  position: absolute;
  right: 0;
  top: 0;
}
<nav class="nav" id='navigation'>
  <ul style="font: normal 14px Tauri, serif ">


    <li style="float: left; border: none ">
      <a href='index.php'>test</a>
    </li>


    <button class="drop"></button>

最佳答案

实际上有一个“导航”但它没有高度。 我做了一个 Fiddle,在其中添加了一些高度和背景颜色,还删除了主体的边距,检查一下!

https://jsfiddle.net/tu9rh3sg/

这用于 HTML(我刚刚关闭了导航):

 <nav class="nav" id='navigation'>
  <ul style="font: normal 14px Tauri, serif ">


    <li style="float: left; border: none ">
      <a href='index.php'>test</a>
    </li>


    <button class="drop"></button>
    </nav>

这是 CSS(高度 + 背景色 + 边距);

    .drop {
  width: 50px;
  height: 50px;
  background-color: #FFFFFF;
  cursor: pointer;
  display: block;
  position: absolute;
  right: 0;
  top: 0;
}
.nav {
  background-color: black;
  height: 50px;
}
body {
  margin: 0 auto;
  margin-top: -14px;
}

如果有帮助请告诉我! ☻

关于html - 导航中的类仅适用于 firefox 中的检查元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48470055/

相关文章:

javascript - 如何在每个X声音上播放音频?在JavaScript中

html - 多级下拉 W3.CSS

asp.net - 带有 :link not in IE or Chrome 的 Firefox css float 错误

html - 焦点上的按钮轮廓出现在左浮动的同级按钮后面的解决方法

javascript - 如何插入可以将用户输入作为文本的选项

java - Java 中的 Zalgo 文本?

html - 如何管理 Angular 响应式设计?

html - 带有段落编号和旁注的 CSS 样式段落

html - margin : 0 auto positioning not working on divs

html - Firefox 中背景图像的过渡?