html - 固定菜单在其下重叠 div

标签 html css

我有一个固定的菜单,在它之后我有一个具有固定背景图像的 div。问题是菜单与第二张图片重叠(因此 100 像素的图片位于菜单下方)。

Example Link: http://codepen.io/gorez16rus/pen/GZjgNB

图片链接:http://www.mygracefalls.com/wp-content/uploads/2014/03/upcoming-events_std_t-e1374861489324.jpg

菜单:

.home-wrap header{
  width: 100%;
  height: 100px;
  background-color: white;
  position: fixed;
  z-index: 10;
}

分区:

.event-box{
  width: 100%;
  height: 520px;
  padding: 0;
  background-image: url('http://www.mygracefalls.com/wp-content/uploads/2014/03/upcoming-events_std_t-e1374861489324.jpg');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: top center;
  background-attachment: fixed;
  overflow: hidden;
  z-index: 3;
  position: relative;
}

最佳答案

解决此问题的最简单方法是更改​​图像的背景位置:

background-position: center 100px;

Modified version of your code on Codepen

关于html - 固定菜单在其下重叠 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35958587/

相关文章:

jquery - 可见性属性问题

html - 垂直图表、CSS、Divs 和 MySql

css - 将 <input type ="text"/> 保持在 100% 的宽度,以免在没有 HTML hack 的情况下溢出其容器,并使其看起来仍然像一个文本框?

jquery - 固定第一列水平滚动表链接不可点击

html - 如何使用内联 css 为宽度设置动画

javascript - 如何将数据从列表组项传递到 PHP 文件?

asp.net - 谁能解决这个 CSS 对齐问题吗?

javascript - 使用 JQuery 剥离菜单

HTML:选择选项样式不起作用

jquery - 将文本放在列表中的图像下方(使用 jQuery lightbox)