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

CSS Alignment

Hello, If you look at the 3 articles below the slideshow you will see that the 3rd one doesn't sit flush with the edge of the wrapper. Was wondering if anyone would know how to fix this.

CodePen: http://cdpn.io/viLIm

Thanks in advance.

2 Answers

If you don't want to use flex box you can go with:

article { width:280px; float:left; margin:30px 0; }

article:nth-child(2n) { margin:30px 60px; }

article:nth-child(3n) { float:right; }

Its not the best way to do it by any means, but its a quick and dirty way to accomplish what you want with those fixed values.

Thank you:)

You're welcome!

Sarah Federman
Sarah Federman
14,048 Points

The easiest way to do this would probably be to use flexbox. Set your article_home div to display: flex (don't forget to add vendor prefixes) and justify-content: space-between. Then you can get rid of the float on your articles.

http://css-tricks.com/snippets/css/a-guide-to-flexbox/

Thanks! :)