HTML
<div class="main">
Lorem ipsum dolor.
</div>
<div class="footer">
<p>More lorem.</p>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
</div>
CSS
.main {
text-align: center;
}
.footer {
background: red;
clear: both;
}
.footer ul {
float: right;
}
.footer li {
display: inline;
}
.footer p {
float: left;
}
Also on JSFiddle.
I’ve simplified a larger version of my main website not working. My footer won’t change colour. See how it says red?
See http://jsfiddle.net/uZs92/2/
Add
When you have floating elements inside the container, you can:
overflow:hidden(or something different thanvisible) to the container -> http://jsfiddle.net/uZs92/2/clear:bothat the end of the container (instead to the container itself) -> http://jsfiddle.net/uZs92/6/:after,::after{content:'.';font-size:0;}to the container -> http://jsfiddle.net/uZs92/5/