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

HTML How to Make a Website Responsive Web Design and Testing Adjust the Profile Page and Header

Megan Sheehan
Megan Sheehan
1,835 Points

How do I clear the float to left alight the last gallery image?

I've set up my clear as the following:

gallery li::nth-child(4n+1) {

clear:left;

But the last gallery item in the smallest viewport is still positioned to the right. Image showing code + issue.

https://drive.google.com/file/d/0B8kaZFztl54Ddk10WGpzZm9yOTg/view?usp=sharing

1 Answer

Austin Whipple
Austin Whipple
29,725 Points

Two issue might be the problem here. First, you have cleared the left side of the element, but the element itself is still carrying the float declared for the other sizes. In order to change that, you'll want to add a float: left; or float: none;

Second, the uneven heights on the items in the row above may force the item (even when floated left) to that slot on the right. Make sure the row is clearing both sides or set the height of all li elements explicitly.