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 Layout Techniques Positioning Schemes Relative Positioning

Is using overflow:hidden; really Best practices ?!

HI Community,

I just saw Guil Hernandez first positioning the element relative and then giving it an overflow:hidden; and wondered, if this is really best practices?! Should we really use this in "real-world" projects?

Yep, overflow hidden is ok to use. It's well supported and does come in handy. Of course just like most code, everything is situational that is really when it comes to you, the developer to decide. It isn't in anyway bad practice and does help in many situations. Really what it does is allow the content to be clipped and remove the scroll bar.

It can also be used on the x and y axis. So overflow-y: hidden; and overflow-x; are also options you can use along with the usual

overflow: visible overflow: hidden overflow: scroll overflow: auto overflow: inherit

Can you please post this as an answer so I can accept this? :)

Good luck!

1 Answer

Yep, overflow hidden is ok to use. It's well supported and does come in handy. Of course just like most code, everything is situational that is really when it comes to you, the developer to decide. It isn't in anyway bad practice and does help in many situations. Really what it does is allow the content to be clipped and remove the scroll bar.

It can also be used on the x and y axis. So overflow-y: hidden; and overflow-x; are also options you can use along with the usual

overflow: visible overflow: hidden overflow: scroll overflow: auto overflow: inherit