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) The Box Model Display Values

Nafitha Mohamed
Nafitha Mohamed
2,637 Points

Overflow

Will overflow: hidden property affect layout of web page?

1 Answer

Ash Scott
Ash Scott
435 Points

Depends.

The overflow property is used to control what happens to items overflowing their parent. Normally, you would use overflow: hidden to hide everything outside of the natural size of an element.

In answer to your question, it depends on what you declare the property on. Sometimes I add overflow-x: hidden to my body tag so that you have no sideways scrolling on the website. Sometimes you may need to do it for an element on the page. If you do need to do this, just be careful that something in your layout might be outside the natural width and height of the element you're applying the overflow: hidden to, and as a result, will be hidden.

Hope that makes sense?