重叠的 div 使链接无法点击
我正在使用 960 网格系统构建 Shopify 主题。
我有以下布局:
<div id="header" class="container_16"> <!-- relatively positioned -->
<div id="tl_overlay"></div> <!-- absolutely positioned top:0 left:0 -->
.
.
.
</div>
<div id="nav" class="container_16">
<ul id="navlist" class="grid_16 push_1">
{% for link in linklists.main-menu.links %}
<li><a href="{{ link.url }}">{{ link.title }}</a></li>
{% endfor %}
</ul>
</div>
问题是 div tl_overlay
有一个背景图像,该图像溢出其内容(根据设计)并与导航 div 重叠,从而使链接无法单击。我尝试在每个元素上设置适当的 z 索引,但仍然无法使其工作。有什么我忘记的事情或者我可以尝试解决这个问题吗?
谢谢
I'm building a shopify theme using 960 grid system.
I have the following layout:
<div id="header" class="container_16"> <!-- relatively positioned -->
<div id="tl_overlay"></div> <!-- absolutely positioned top:0 left:0 -->
.
.
.
</div>
<div id="nav" class="container_16">
<ul id="navlist" class="grid_16 push_1">
{% for link in linklists.main-menu.links %}
<li><a href="{{ link.url }}">{{ link.title }}</a></li>
{% endfor %}
</ul>
</div>
The problem is the div tl_overlay
has a background image which overflows its content (by design) and overlaps the navigation div, making the links unclickable. I've tried setting appropriate z-indexes on each element but still cannot get it to work. Is there anything i've forgotten or anything I can try to fix this!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
z-index 必须有效,但
nav
和header
div 应该以非静态方式定位。position:relative
应该可以在不破坏你的设计的情况下完成任务。所以你应该确保你的CSS中有以下内容:
z-index must work, but the
nav
andheader
div should be positioned in a non-static way.position: relative
should do the trick without breaking your design.so you should make sure you have the following in your css:
很高兴看到 CSS。
您在哪些元素上设置了 z-index?
我会尝试使用
#header { z-index: 10}
和#nav { z-index: 20}
但可能是错误的。当然#nav需要定位。
It would be nice to see the CSS.
On what elements did you set the z-index?
I would have tried on the
#header { z-index: 10}
and#nav { z-index: 20}
but could be wrong. Of course #nav needs to be positioned.