首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >下拉菜单不显示Foundation5

下拉菜单不显示Foundation5
EN

Stack Overflow用户
提问于 2014-05-11 07:24:47
回答 1查看 257关注 0票数 0

我一直在处理基金会的下拉菜单,但我的菜单没有出现。每次我在父链接上悬停时,下拉菜单只有在我悬停在菜单应该出现的区域之后才会出现。有什么想法吗?

JS Fiddle:http://jsfiddle.net/hHP4q/

HTML:

代码语言:javascript
复制
<nav class="top-bar" data-topbar id="nav-bar">
        <ul class="left">
            <li class="nodrop"><a href="#">home</a></li>

        <li class="has-dropdown">
            <a href="#">SAT I</a>

            <ul class="dropdown">
                <li class="drop"><a href="#">Score a Test</a></li>

                <li class="drop"><a href="#">Past Tests</a></li>
            </ul>
        </li>

        <li><a href="#">SAT II</a></li>
    </ul>
</nav>

CSS:

代码语言:javascript
复制
.top-bar {
    width: 768px;
    margin: 0 auto;
    padding: 0;
    height: 50px;
    background-color: #518c52;
}

/* line 42, ../scss/styles.scss */
.top-bar ul {
    line-height: 50px;
    height: 50px;
}

/* line 45, ../scss/styles.scss */
.top-bar ul li {
    display: inline-block;
    float: left;
    width: 75px;
    transition: background-color 1s;
    -webkit-transition: background-color 1s;
    text-align: center;
    height: 50px;
}

/* line 53, ../scss/styles.scss */
.top-bar ul li a {
    font-size: 18px;
    color: #FFF;
}

/* line 58, ../scss/styles.scss */
.top-bar ul li:hover {
    height: 50px;
    background-color: #3e713f;
}

/* line 62, ../scss/styles.scss */
.top-bar ul .dropdown {
    width: 100px;
    margin: 0;
    padding: 0;
}

/* line 67, ../scss/styles.scss */
.top-bar ul .drop {
    width: 100px;
    margin: 0;
    padding: 0;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-11 08:10:49

演示

我所做的是将ul隐藏在.dropdown类li中,并在悬停时公开它。

CSS:

代码语言:javascript
复制
.top-bar {
    width: 768px;
    margin: 0 auto;
    padding: 0;
    height: 50px;
    background-color: #518c52;
}
/* line 42, ../scss/styles.scss */
 .top-bar ul {
    line-height: 50px;
    height: 50px;
}
/* line 45, ../scss/styles.scss */
 .top-bar ul li {
    display: inline-block;
    float: left;
    width: 75px;
    transition: background-color 1s;
    -webkit-transition: background-color 1s;
    text-align: center;
    height: 50px;
    background-color: #518c52;
}
.top-bar ul li.has-dropdown ul {
    display:none;
}
.top-bar ul li.has-dropdown:hover ul {
    display:block;
}
/* line 53, ../scss/styles.scss */
 .top-bar ul li a {
    font-size: 18px;
    color: #FFF;
}
/* line 58, ../scss/styles.scss */
 .top-bar ul li:hover {
    height: 50px;
    background-color: #3e713f;
}
/* line 62, ../scss/styles.scss */
 .top-bar ul .dropdown {
    width: 100px;
    margin: 0;
    padding: 0;
}
/* line 67, ../scss/styles.scss */
 .top-bar ul .drop {
    width: 100px;
    margin: 0;
    padding: 0;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23590079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档