Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Floats and clearfix

Hey Guys, Im super new and have done the basics of HTML and CSS. Im trying to use what I've learnt to create a few websites before continuing on with my course in the hope that it retains more info. The problem is floats. I want to float two images side my side, centered on the page with the footer stuck to the bottom of the page. No matter what I do, I cant get the footer to stick and I cant get the two images to sit nicely on the page. Ive played with clearfixes, margins, padding- everything! Any help would be great!!!

.cherry {
float: left;
  height: 400px;
  width: 400px;
display: inline-block;
margin: 50px;
  padding: 5px;
}

 .mocha {
float: right;
  height: 400px;
  width: 400px;
display: inline-block;
margin: 50px;
  padding: 5px;
}

img {
max-width: 100%;
border-radius: 10px;
}

  .main-footer {
padding-top: 60px;
padding-bottom: 60px;
border-bottom: 10px solid #000;
  text-align: center;
  position: fixed;
Width: 100%;
bottom: 0;  
}

.clearfix:after { 
   content: "."; 
   visibility: hidden; 
   display: block; 
   height: 0; 
   clear: both;
}

Can you give us a link or a picture to see what you mean? btw the word width on the main-footer must be all low caps

1 Answer

For your footer try:

.main-footer {
padding-top: 60px;
padding-bottom: 60px;
border-bottom: 10px solid #000;
  text-align: center;
  position: fixed;
width: 100%;
bottom: 0;
clear: both;

I changed the width to be all in lower case and also used clear:both. This will clear both your image floaters.

Hope this helps!

Brian