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 trialPhilip G
14,600 PointsIs 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?
Philip G
14,600 PointsCan you please post this as an answer so I can accept this? :)
Dylan Hobbs
9,279 PointsGood luck!
Pavle Lucic
10,801 PointsGood question.
1 Answer
Dylan Hobbs
9,279 PointsYep, 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
Dylan Hobbs
9,279 PointsDylan Hobbs
9,279 PointsYep, 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