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 Basics (2014) Basic Layout Floats

Reason for overflow: auto instead of hidden?

First of all this is an amazing series. I'm taking it for a second time skimming thru sections as a refresher. Floats have always been a bit tricky to me.

When testing the code I realized that overflow: hidden also works. What's the reason for using overflow auto instead of hidden? Both appear to render the same result. Is there a difference? I plan on using Guil's approach but want to be thorough for my own understanding.

Thanks in advance =)

2 Answers

So the main difference between overflow: auto and overflow: hidden is the fact that overflow: hidden just hides all the excess content, while overflow: auto will add a scrollbar if necessary so you can see the hidden content when you scroll. I referenced these links: https://css-tricks.com/the-css-overflow-property/ https://developer.mozilla.org/en-US/docs/Web/CSS/overflow

Fran ADP
Fran ADP
6,304 Points

They dont have much similarities, just that the browser inspects them in different ways.