css - 如何使 Firefox 中的下拉菜单看起来与 Chrome/IE 中的一样?

标签 css twitter-bootstrap google-chrome firefox

因此,我正在构建一个带有下拉菜单的网站。在 Chrome 中它看起来不错,但在 Firefox 上它不需要填充,我想找到一种方法让它们在两种浏览器上看起来一样。

我知道这是一个已知问题,但我没有找到适合我的问题的解决方案。

这是下拉列表中的绘图

enter image description here

调试代码

<div class="collapse navbar-collapse" id="MainMenu_nav">
   <ul class="navbar-nav nav h>
      <li aria-haspopup="true" class="HasItems hover focus">
         <div class="Wrapper" tabindex="-1">
              ....
          </div>
      </li>
     </ul>
   </div>

CSS

.navbar-collapse{
   max-height:none;
   margin-left:-10px;
   margin-right:-10px;
}

.h{
    position:relative;
    back-ground-color:black;
    margin-left:5px;
    white-space:nowrap;
    width:100%;
    display:table;
}

.h>li.hover{
     background-color:white;
     top:3px
}
.h>li{
   position:Relative;
   white-space:nowrap;
   display:table-cell;
   float:none;
   vertical-align:middle
}

这里应用的技巧是什么?

最佳答案

有趣的是,我猜这个问题可能与下拉列表无关,而是因为 firefox 不知何故忽略了填充。 好像我错了,因为根据this answer , 这是 Chrome 而不是 Firefox 的错误

我已经通过简单地将 li 显示为 block 来解决了这个问题

@-moz-document url-prefix(){
     .h >li.hover{
         height:45px;
         display:block;
         top:3px;
     }
}

关于css - 如何使 Firefox 中的下拉菜单看起来与 Chrome/IE 中的一样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30570601/

相关文章:

html - Bootstrap 4 六个盒子在同一行(响应式)?

html - 定位元素,但没有剩余空间

css - 使用 Wordpress 预览图像和 Bootstrap 换行

html - 顶栏附加到左侧栏

css - Twitter bootstrap 井 Angular 文本/图像

将日期添加到数组的 JavaScript for 循环会卡住某些 PC 上的页面

javascript - 导航到新链接时内容脚本无法运行

jquery - xsl :include and xsl:param at Google Chrome, 与 jQuery 转换插件

javascript - 如何通过javascript更改css伪元素?

html - 如何在 Bootstrap 导航栏上添加背景悬停颜色?