3

我也很难让这个工作,出于某种奇怪的原因,DIV 确实水平对齐正确,但第二个 div 最终在第一个下面。任何帮助将不胜感激。

HTML:

<footer>
    <div class="inner">
    <section id="footer-copyright" class="clear left">
    <ul>
    <li>© 2013
    <a href="/">Company</a>
    |
    <a href="sitemap.html">Sitemap</a>
    |
    <a href="privacy.html">Privacy Policy</a>
    </li>
    </ul>
    </section>
    <section class="footer-box clear right">
    <ul>
    <li>Design by <a href="/" target="new">Template</a></li>
    </ul>
    </section>
    </div>
</footer>

CSS:

footer .inner {
    padding-top: 50px;
}

#footer-copyright {
    display: block;
    padding-top: 35px;
    width:50%;
}

#footer-box {
    display: block;
    padding-top: 35px;
}

footer ul {
    color: #FFFFFF;
    list-style: none outside none;
    padding: 10px 0;
}

.inner {
    margin: 0 auto;
    position: relative;
    width: 1000px;
}

.clear {
    clear: both;
    display: block;
}

.right, .alignright {
    float: right;
}

.left {
   float:left;
}

也许我只需要一双新的眼睛...... :)

您可以在此处查看工作链接

4

2 回答 2

2

这是因为您footer-boxclear: both;规则集(来自clear班级)。删除它并添加padding-top: 35px.

于 2013-01-21T01:42:22.490 回答
1

#footer-boxhasclear: both由于它的clear类,所以它在#footer-copyright.

于 2013-01-21T01:42:37.823 回答