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

General Discussion

Content flow when shrinking screen size.

I'm trying to get my content on the website I am making to stack on top of one another (like blocks on top of one another) as the screen size shrinks. It seems like they will only go side by side.... What is it that I am not doing??? I've been messing with it for two days now.

Thanks

5 Answers

Kevin Korte
Kevin Korte
28,148 Points

Depending on what elements are in play can change the answer, but does this give you some help with what you're trying to achieve?

resize your browser to watch the divs go from float to stack. Pay attention to their order in the html and the order they stack.

http://codepen.io/anon/pen/vkgGf

James Barnett
James Barnett
39,199 Points

Casey Balza - I'd suggest you create a codepen with just the code that is giving you trouble and we will have a look.

You might be intrested in checking out learnlayout.com, it's the best tutorial of positioning content using CSS that I've seen.

Thanks Kevin, that code should help me figure this out. I haven't tried to fix what I have yet (just got back from work). And thanks for the tutorial site James, I will go through it soon to get a better understanding of this.

Here is the code I am having trouble with, http://codepen.io/anon/pen/IgqJk

Thanks :)

James Barnett
James Barnett
39,199 Points

Casey Balza - Your divs are re-sizing themselves to the a percentage of your page. To fix it don't use width as a percentage, use either px or em.

Wow....I knew it was something simple. Thanks James, it works now :)