-1

我试图让我的菜单贴在标题的底部。我已经尝试过将其删除,删除浮动,添加一些,使用填充/边距(这在我看来不是一个选项?

    <div id="header">
    <div id="logo">
        <h1><a href="#">blah</a></h1>
        <h3>Blah</h3>
    </div>
    <div id="menu">
        <ul>
            <li><a href="#" accesskey="1" title="">qsdfqsdfqsdf</a></li>
            <li><a href="#" accesskey="2" title="">qsdfqdsfqsdf!</a></li>
            <li><a href="#" accesskey="3" title="">qdsf</a></li>
            <li><a href="#" accesskey="3" title="">qdsf</a></li>
        </ul>
    </div>
</div>

CSS:

/** HEADER */

#header {
    height: 125px!important;
    background: #000;
    position: fixed;
    top: 0;
    width: 100%;
}

/* Logo */

#logo
{
    float: left;
    width: 250px;
    padding: 20px 0px 0px 50px;
    text-transform: uppercase;
}

#logo h3{
    color: #fff;
    margin-left: 1em;
    font-size: 1em;
}

#logo h1
{
    padding: 5px 10px 0px 0px;
}

#logo h1 span, #logo h3 span{
    color: #000;
}

#logo h1 a
{
    text-decoration: none;
    font-size: 1.5em;
    font-weight: 300;
    color: #FFFFFF;
}

#logo p
{
    display: block;
    margin-top: -10px;
    padding: 0px 0px 0px 0px;
    letter-spacing: 1px;
    font-size: 1.2em;
    color: #FFFFFF;
}

#logo p a
{
    color: #FFFFFF;
}

/* Menu */

#menu{
    float: right;
    width: 600px;
    margin: 2em 2em 0 0;
}

#menu ul{
    float: right;
    margin: 0;
    padding: 0;
    list-style: none;
    line-height: normal;
    position: relative;
    display: inline-table;
}

#menu li
{
    float: left;
}

#menu a
{
    display: block;
    letter-spacing: 1px;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 18px;
    font-weight: 300;
    color: #FFFFFF;
    padding: 1em;
    text-decoration: none;
}



#menu a:hover{
    color: #000;
    text-decoration: none;
    background: #fff;
}

#menu ul li {
    float: left;
}

#menu ul li:hover {

}

这里是一个例子:http: //jsfiddle.net/2wmSt/

4

1 回答 1

1

几乎就在那里,只需将菜单绝对定位到标题的底部。

#menu{
    position:absolute;
    bottom:0;
    right:0;
}

jsfiddle 示例

于 2013-09-01T19:27:25.883 回答