简体   繁体   English

子菜单隐藏在导航div中

[英]submenu is hiding in the navigation div

I'm coding a client site http://scratchmediaohio.com/wordpress/ 我正在编码客户网站http://scratchmediaohio.com/wordpress/

When I coded locally, the submenu had no trouble showing up on hover, but now as I'm slowly integrating to wordpress, I'm having various issues trying to get it to show up. 当我在本地编码时,该子菜单在悬停时显示没有问题,但是现在随着我逐渐集成到wordpress中,我遇到了各种各样的问题试图显示它。 I've tried z-indexing, etc., I'm sure I've overdone something or overlooked something but I'm running out of ideas. 我已经尝试过z-indexing等,我确定我做过一些事情或忽略了一些事情,但是我的想法已经用完了。

css code: CSS代码:

 #navigation { list-style: none; padding: 0; margin: 0; font-family: 'sinkin_sans400_regular'; font-size: 13px; font-weight: normal; text-transform: uppercase; background: rgb(58,58,58); border-top: solid 3px #fff; border-bottom: solid 3px #fff; /* box-shadow: 0px -2px 3px -1px rgba(0, 0, 0, 1); */ } #navigation li { float: left; } #navigation li:hover { background: #f2dcc7; color: white; -webkit-border-radius: 0px 0px 8px 8px; -moz-border-radius: 0px 0px 8px 8px; border-radius: 8px 8px 0px 0px; } #navigation li:first-child { } #navigation li a { display: block; padding: 12px 20px; font-size: 12px; text-decoration: none; line-height: 40px; color: #6d4927; } #navigation li a:hover { color: #6d4927; } #navigation ul { /*display: none;*/ position: absolute; list-style: none; margin-left: -3px; padding: 0; overflow: hidden; } #navigation ul li { /*float: none;*/ } #navigation li:hover > ul { display: block; background: #f2dcc7; border: solid 3px #fff; color: #6d4927; border-top: 0; -webkit-box-shadow: 0px 3px 3px 0px rgba(0, 0, 0, 0.25); box-shadow: 0px 3px 3px 0px rgba(0, 0, 0, 0.25); -webkit-border-radius: 0px 0px 8px 8px; -moz-border-radius: 0px 0px 8px 8px; border-radius: 0px 0px 8px 8px; } #navigation li:hover > ul li:hover { } #navigation li li a:hover { background: #d69f6b; color: white; } .sub-menu {} 

As a note, I did grab this submenu code from a codepen and tried tweaking it as it had issues in the beginning. 值得注意的是,我确实从一个Codepen中获取了此子菜单代码,并尝试对其进行了调整,因为它在一开始就存在问题。

You #navigation ul is overflow:hidden; 您# #navigation ul overflow:hidden;

By amending it to: 通过将其修改为:

#navigation ul {
  overflow: visible;
}

Your submenus will show 您的子菜单将显示

You have a few things wrong with your html, on your site but to answer your question above... 您的网站上的html有点问题,但您需要在上面回答您的问题...

Firstly remove the overflow hidden style from the nav ul. 首先,从导航中删除溢出隐藏样式。

#navigation ul {/*overflow: hidden;*/}

Then apply these two styles: 然后应用以下两种样式:

.sub-menu {display: none;}
li.menu-item-has-children:hover > .sub-menu {display: block;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM