1

I'm trying to clear the footer like so:

<div>
    <div class="left">Left</div>
    <div class="right">Right</div>
    <div class="footer clear">Footer</div>
<div>

.left {
    background-color: red;
    float: left;
}

.right {
    background-color: blue;
    float: right;
}

.footer {
      background-color: orange;
}

// clear
.clear {
   clear: both;
}

Fiddle here: http://jsfiddle.net/RYYFw/8/

But the footer is not clearing. Does anyone know why?

4

2 回答 2

8

这是您的评论//导致错误。在 CSS 中是不允许的。

利用/* comment */

于 2013-03-25T10:41:44.977 回答
1

如果您删除无效//评论,您将获得您想要的结果..

于 2013-03-25T10:43:04.667 回答