清除页脚不起作用

Jam*_*ron 1 html css

我试图像这样清除页脚:

<div>
    <div class="left">Left</div>
    <div class="right">Right</div>
    <div class="footer clear">Footer</div>
<div>
Run Code Online (Sandbox Code Playgroud)
.left {
    background-color: red;
    float: left;
}

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

.footer {
      background-color: orange;
}

// clear
.clear {
   clear: both;
}
Run Code Online (Sandbox Code Playgroud)

在这里小提琴:http://jsfiddle.net/RYYFw/8/

但是页脚没有清除.有谁知道为什么?

bte*_*fik 8

这是你的评论//导致错误.它不允许在CSS中使用.

使用 /* comment */

  • 为了扩展这个答案,第15行上的`// clear`注释抛出了一个`样式结束'异常,阻止了任何进一步的样式呈现. (2认同)