【问题标题】:Weebly Navigation - Parent Menu Item Stays in hover when mouse on child itemWeebly Navigation - 当鼠标悬停在子项上时,父菜单项保持悬停
【发布时间】:2013-05-13 22:15:44
【问题描述】:

所以,我是 CSS 和 HTML 的初学者,我从过去的一个小时开始尝试让它工作,但它就是不会!

所以我希望当鼠标经过下拉菜单中该父级的子级时,父级菜单项保持悬停状态。

这是我的代码..

HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body class='short-header-page  wsite-theme-light'>

        <div id="header-wrap">
            <div class="container">
                <table id="header">
                    <tr>
                        <td id="header-right">
                            <table>
                                <tr>
                                    <td class="phone-number">{phone:text}</td>
                                    <td class="social">{social}</td>
                                    <td class="search">{search}</td>
                                </tr>
                            </table>
                            <div class="clear"></div>
                        </td>
                    </tr>
                </table>
            </div><!-- end container -->
        </div><!-- end header-wrap -->          

        <div id="nav-wrap">
            <div class="container">
                <table>
                    <tr>
                        <td id="logo">{logo}</td>
                        <td id="nav"><div id="navigation">{menu}</div></td>
                    </tr>
                </table>
            </div><!-- end container -->
        </div><!-- end nav-wrap -->

        <div id="banner-wrap">
            <div class="container">
                <div id="banner">
                        <div class="wsite-header"></div>
                    <div style="clear:both;"></div>
                </div><!-- end banner -->
            </div><!-- end container -->
        </div><!-- end banner-wrap -->

        <div id="main-wrap">
            <div class="container">
                {content}
            </div><!-- end container -->
        </div><!-- end main-wrap -->

    <div id="footer-wrap">
        <div style="visibility:hidden;"class="container">
            {footer}
        </div><!-- end container -->
    </div><!-- end footer-wrap -->
</body>
</html>

CSS

/* Navigation
--------------------------------------------------------------------------------*/

#nav-wrap .container {
    clear: both;
    overflow: hidden;
    position: relative;
    border-bottom:1px solid #E8E8E8;
    margin-bottom:40px;
}

#nav-wrap .container table, #nav-wrap .container table tr, #nav-wrap .container table tr td, #nav-wrap .container table tbody {
    vertical-align:bottom;
}

td#nav {
    float:right;
}
#navigation {
    line-height: 1;
    float: right;
}

#navigation ul {
    display: inline;
    list-style: none;
    float: right;
    max-width:700px;
    margin-bottom:-1px;
}

#navigation li {
    display: inline;
    position: relative;
    list-style: none;
    margin-left:6px;
    float: left;
}

#navigation ul li a {
    display: block;
    color: #333;
    text-decoration: none;
    padding: 18px 7px 8px;
    margin:0 0px 1px;
    border: 0;
    outline: 0;
    list-style-type: none;
    box-sizing:border-box;
    float: left;
    font:13px 'Bookman',arial,sans-serif;
    text-transform:uppercase;
}

#navigation ul li#active a{
    padding: 18px 7px 4px;
    border-bottom:4px solid #72bc11;
    color:#000;
}

#navigation ul li a:hover {
    padding: 18px 7px 4px;
    border-bottom:4px solid #FF6600;
    color: #000A0F;
}
#navigation ul li a:hover {
    padding: 18px 7px 4px;
    border-bottom:4px solid #FF6600;
    color: #000A0F;
}
/* Navigation Submenu's
--------------------------------------------------------------------------------*/

#wsite-menus .wsite-menu {
    background:#fff;
    position:relative;
}


#wsite-menus .wsite-menu li a {
    background: #F4F4F4;
    border:none;
    border-bottom: 1px solid #E8E8E8;
    border-top: 1px solid white;
    display: block;
}

#wsite-menus .wsite-menu li a:hover {
    color: #72bc11;
    background: #eee;
}

你们能帮帮我吗?请我绝望,我不知道如何使这项工作! :/

【问题讨论】:

  • 您的 CSS 显示 ulli 标签的导航标签,但您的 html 没有。这看起来是某种类型的 word press 或类似文档。当您在 html 元素中出现 {} 时,特别是 {menu},它通常表示某种类型的标记已被管理架构所取代。这意味着当在浏览器中查看时,导航会被注入到页面上。这里没有什么可处理的
  • 您需要查看具有渲染菜单的页面并在浏览器中查看源代码。然后您可以复制/粘贴导航的相关部分
  • 你在所有这些表上都走错了路。这是一个您可以使用的简单下拉示例:pmob.co.uk/temp/dropdown_horizontal2.htm(只需查看源代码即可获取代码。)
  • 好吧,weebly 被证明不是那么可定制的。我将从我的站点获取完整的代码并将其分开添加 - 能够对其进行编辑。谢谢你们:)

标签: html css hover nav


【解决方案1】:
#wsite-menus .wsite-menu: hover #navigation ul li a {
    color: #333;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-30
    • 2023-03-31
    • 2012-03-15
    相关资源
    最近更新 更多