Firefox中的navbar品牌css问题

时间:2015-05-28 20:00:54

标签: html css twitter-bootstrap firefox

我最近意识到我的导航栏品牌形象在常用的网络浏览器Mozilla Firefox中无法正常显示。

css在Chrome和Internet Explorer(wat)中效果很好。

我已经尝试过使用css但我永远无法在Firefox中使用它。我检查过,似乎填充和Bootstrap在Firefox中无法正常工作存在问题。无论如何,这是我的代码:

<html>
<head>   
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">   
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">   
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>   
</head>
<body>  
  <nav class="navbar navbar-default navbar-fixed-top" id = "navbarprincipal">
        <div class="container" id="containernav">
          <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand">
          <img src="http://placehold.it/784x306" class = "brand" id="imagenavbar" alt="Logo">
        </a>          
          </div>
          <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">                      
              <li class="dropdown">
                <a class="dropdown-toggle" id="dropdownMenuViewMode" data-toggle="dropdown" role="button" aria-expanded="false" ><span class="glyphicon glyphicon-eye-open pull-left"></span>Day<span class="caret"></span></a>
                <ul class="dropdown-menu" id="dropdownViewModeSelect"  role="menu">
                  <li viewmode = "jour" viewmodesecondary = "classic"><a id="linkJour">Day<i class='dropdownFiltreImage glyphicon glyphicon-ok'></i></a></li>                  
            </ul>
          </div><!--/.nav-collapse -->
        </div>
  </nav>
</body>
</html>

html, body {
    margin: 0px;
    padding: 0px;
    height: 100%;
    padding-top: 25px;
}

@media (max-width: 768px) {
  .btncarousel {
    padding:2px 4px;
    font-size:80%;
    line-height: 1;
    border-radius:3px;
  }

  #containernav{
    width: 100%;
  }

  .carousel-caption h3{
    font-size:85%;
  }

  .carousel-caption p{
    font-size:80%;
  }
}

@media (min-width: 769px) and (max-width: 992px) {
  .btncarousel {
    padding:4px 9px;
    font-size:90%;
    line-height: 1.2;
  }

  .carousel-caption h3{
    font-size:95%;
  }

  .carousel-caption p{
    font-size:90%;
  }
}

.btncarousel{
    margin-bottom: 2px;
    margin-top: -4px;
}

video{
max-width: 100%; height: auto;
}

a:link {
    text-decoration: none;
    color : #767676;
}
.navbar {
    background: #fcd404;
    color: #292929;
    margin: 0px;

}

.navbar-brand img {
    margin-top: -7.7%;
    height: 160%;
}

.navbar a {
    -webkit-user-select: none;
}

#scheduler_here {
    width: 100%;
    height: 100%;
}

.navbar a {
    cursor: pointer;
}

.dhx_cal_navline {
    display: none;
}

#custom_form {
    -webkit-box-shadow: 6px 6px 5px 0px rgba(50, 50, 50, 0.75);
    -moz-box-shadow: 6px 6px 5px 0px rgba(50, 50, 50, 0.75);
    box-shadow: 6px 6px 5px 0px rgba(50, 50, 50, 0.75);
    padding: 20px;
    z-index: 10001;
    display: none;
    background-color: white;
    font-family: Tahoma;
    font-size: 10pt;
    border-radius: 5px;
    left: 25%;
    width: 85%;
    top: 25%;
    position: absolute;
    text-align: center;
}

#custom_form input {
    text-align: center;
}
.tab-content {
    margin-top: 10px;
}
#dropdownFiltre {
    margin-right: 20px;
}
.btnnavbarright {
    margin-top: 7px;
}
#txtDescription {
    height: 209px;
    width: 364px;
}
.sectionFilter {
    margin-left: 20px;
}
.dropdownFiltreImage {
    margin-left: 5px;
}
.carousel-inner > .item > img {
    margin: 0 auto;
}

#carouselHelp {
    -webkit-box-shadow: 0px 5px 5px 0px rgba(50, 50, 50, 0.75);
    -moz-box-shadow: 0px 5px 5px 0px rgba(50, 50, 50, 0.75);
    box-shadow: 0px 5px 5px 0px rgba(50, 50, 50, 0.75);
    border-top: 1px solid black;
}
.carousel-caption {
    background: rgba(0,0,0,0.5);
color: white;
}
.glyphicon-filter {
    margin-top: 1.9px;
    margin-right: 2px;
}
.glyphicon-eye-open {
    margin-top: 1.9px;
    margin-right: 2px;
}
canvas {
    position: absolute;
    z-index: 999;
    top: 40%;
    left: 40%;
}
.marginBottom-0 {
    margin-bottom: 0;
}
.dropdown-submenu {
    position: relative;
}
.dropdown-submenu>.dropdown-menu {
    top: 0;
    left : 100%;
    margin-top: -6px;
    margin-left: -1px;
    -webkit-border-radius: 0 6px 6px 6px;
    -moz-border-radius: 0 6px 6px 6px;
    border-radius: 0 6px 6px 6px;
    height: auto;
    max-height: 250px;
    overflow-x: hidden;
}
.dropdown-submenu>a:after {
    display: block;
    content: " ";
    float: right;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    border-width: 5px 0 5px 5px;
    border-left-color: #cccccc;
    margin-top: 5px;
    margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
    border-left-color: #555;
}
.dropdown-submenu.pull-left {
    float: none;
}

.dropdown-submenu.pull-left>.dropdown-menu {
    left: -100%;
    margin-left: 10px;
    -webkit-border-radius: 6px 0 6px 6px;
    -moz-border-radius: 6px 0 6px 6px;
    border-radius: 6px 0 6px 6px;
}
.navbar-right .dropdown-menu {
    right: inherit;
}

.menu-half {
    display: inline-block !important;
}

span.twitter-typeahead .tt-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  float: left;
  min-width: 160px;
  padding: 5px 0;
  margin: 2px 0 0;
  list-style: none;
  font-size: 14px;
  text-align: left;
  background-color: #ffffff;
  border: 1px solid #cccccc;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
  background-clip: padding-box;
}
span.twitter-typeahead .tt-suggestion > p {
  display: block;
  padding: 3px 20px;
  margin-bottom: 0px;
  clear: both;
  font-weight: normal;
  line-height: 1.42857143;
  color: #333333;
  white-space: nowrap;
}
span.twitter-typeahead .tt-suggestion > p:hover,
span.twitter-typeahead .tt-suggestion > p:focus {
  color: #ffffff;
  text-decoration: none;
  outline: 0;
  background-color: #428bca;
}
span.twitter-typeahead .tt-suggestion.tt-cursor {
  color: #ffffff;
  background-color: #428bca;
}
span.twitter-typeahead {
  width: 100%;
}
.input-group span.twitter-typeahead {
  display: block !important;
}
.input-group span.twitter-typeahead .tt-dropdown-menu {
  top: 32px !important;
}
.input-group.input-group-lg span.twitter-typeahead .tt-dropdown-menu {
  top: 44px !important;
}
.input-group.input-group-sm span.twitter-typeahead .tt-dropdown-menu {
  top: 28px !important;
}

.typeahead, .tt-query, .tt-hint {
  padding: 8px 12px;
  line-height: 30px;
  border: 2px solid #ccc;
  -webkit-border-radius: 8px;
  -moz-border-radius: 8px;
  border-radius: 8px;
  outline: none;
}

.modal-backdrop.in {
  opacity: 0;
}

我将我的代码放在CodePen中,因此它很容易获得,因为它是一个视觉问题:

http://codepen.io/anon/pen/YXNwqw

你可以在Firefox中看到图像不像Chrome或IE那样显示。

感谢您的帮助。

1 个答案:

答案 0 :(得分:3)

这是因为.navbar-brand的填充,如引导文档中所述

  

由于.navbar-brand有自己的填充和高度,您可能需要根据图像覆盖一些CSS。

此外,您的以下css声明似乎导致Firefox中的问题:

.navbar-brand img {
    margin-top: -7.7%;
    height: 160%;
}

将其替换为例如:

.navbar-brand img {
    height: 30px; 
    margin-top: -5px;
}

它应该跨浏览器工作。

Working Example

Updated codePen