0

我正在尝试执行以下操作:单击PORTFOLIO http://jsfiddle.net/kuuwj/25/,当您单击投资组合按钮子菜单时可以看到。但是我改变了颜色,所以你可以看到问题。一个问题是下一个按钮ABOUT ME将展开以保持相同的边距,并且它将与portfolio-apps类重叠。所以我想解决这个问题。以这样一种方式,about me将具有相同的边距,但从最后section一个portfolio-apps

CSS

#navbar {
    list-style: none;
    z-index: 9;
    width: 255px;
    display: block;
    margin-top: 20px;
    margin-bottom: 20px;
    background: #ccc;
}
#navbar a {
    text-decoration: none; /* removes underline for links */
    text-transform: uppercase;
    font-size: 16px;
    display: block;
    background: #fff; /* for webbrowsers that does not support CSS3 */
    background: rgba(255,255,255,0.9);
    line-height: 50px; /* specifies the line height */
    padding: 0px 20px;
    color: rgb(68,68,68);
}

#navbar a:hover { /* Select a style of a link when the mouse over it */
    background: #bbb;
}

#navbar li {
    margin-bottom: 6px;
}

.button {
    position: relative;
    display: block;
    float: left;
    line-height: 35px;
    left: 75px;
    padding-right: 10px;
    text-align: right;
    font-size: 16px;
}

span {
    background: #EEE;   
}

HTML

<ul id="navbar">
    <li><a href="#home" id="nav-home">Home</a></li>
    <li><a href="#portfolio" id="nav-portfolio">Portfolio</a>
        <div class="portfolio-apps">
         <section id="website">
            <span class="button">AAAAAAAAAAAAAAAAAAAAAA</span>
         </section>
         <section id="gterminal">
            <span class="button">BBBBBBBBBBBBBBBBBBBBBB</span>
         </section>
         <section>
            <span class="button">CCCCCCCCCCCCCCCCCCCCCC</span>
         </section>
        </div>
    </li>
    <li><a href="#about" id="nav-about">About Me</a></li>
    <li><a href="#contact" id="nav-contact">Contact</a></li>
   </ul>
4

1 回答 1

1

你必须清除你的花车 -演示

.clearfix:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.clearfix {
    display: inline-block;
}

html[xmlns] .clearfix {
    display: block;
}

* html .clearfix {
    height: 1%;
}
于 2013-01-22T22:17:20.680 回答