CSS - 背景图像

标签 css html

我已经为我的菜单背景设置了background-image,至于菜单后面的黑条: http://www.cochlea.co.il/

  background-image: url("http://www.cochlea.co.il/wp-content/uploads/2015/07/bar.png");
  background-repeat: no-repeat;
  background-position: inherit;

但是,有时无法加载黑色背景。有时当您向下滚动然后向上滚动时,它会消失。

有什么问题?

非常感谢。

最佳答案

我注意到每当我们向下滚动时它就会隐藏起来。

好吧,如果您删除背景图像并允许背景为黑色怎么样?

使用此代码

    .main-navigation ul {
      list-style: none;
      margin: 0;
      display: inline;
      background: #000;
      padding: 5px;
      border-radius: 28px;
      padding-left: 30px;
      padding-right: 30px;
    }
.theNavigationBar {
  position: absolute;
  width: 100%;
  top: 15px;
  left: 0;
  text-align: center;
  font-weight: bold;
  /* background-image: url("http://www.cochlea.co.il/wp-content/uploads/2015/07/bar.png"); */
  /* background-repeat: no-repeat; */
  /* background-position: inherit; */
  /* letter-spacing: 0.5px; */
}

它的作用与背景图像的作用相同。所以简单地使用上面的代码。

关于CSS - 背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31368878/

相关文章:

html - 垂直对齐页面上的元素,同时保持相同的高度

javascript - Google Charts 图例未正确显示

javascript - 单击时显示 html anchor 的标题属性

html - div 之间的额外空间从何而来?

html - 图像在 CSS 过渡期间不会混合

html - 设置特定 html-class 时覆盖悬停伪类 CSS 属性

javascript - 表行上的 jQuery 可排序无法移动

javascript - 你如何在 IE9 中点击透明的 PNG?

html - 如何使用 bootstrap3 在移动 View 中以正确的顺序显示 div 表数据?

HTML/CSS : Table text align