Jamie Fearon
Jamie Fearon

Reputation: 2634

Clearing Footer not working

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?

Upvotes: 1

Views: 179

Answers (2)

btevfik
btevfik

Reputation: 3431

It's your comment // causing the error. It is not allowed in CSS.

Use /* comment */

Upvotes: 8

Rob
Rob

Reputation: 4947

If you remove the invalid // comment you'll get your desired result..

Upvotes: 1

Related Questions