Why does child element cause parent to overflow
I don't understand why setting overflow hidden on the page info section causes the section to properly fit within the bottoms section container.
Without that, the long website link causes the content to overflow the container.
I have a solution but I just want to know why it works and also if there's a different way to do this because this feels hacky idk? I was trying to think of a way to set the width of the section containing the title to fit within the container but couldn't come up with a solution.
5 Replies
This shows how the section now fits within the padding once overflow hidden is set.
i don't use tailwind but to me it looks like you're setting a fixed width and height with
h-[50px] w-[50px]
. You shouldn't do that, let the content decide the size of the container. That's why it's overflowing. overflow: hidden
hides it because as it says, it's hiding the overflow.that isn't the problem. 50px is too small to even cause overflow issue. also, this is an exception since it is an icon which you don't want to scale.
My bad then. Didn’t see that.
MDN Web Docs
overflow-wrap - CSS: Cascading Style Sheets | MDN
The overflow-wrap CSS property applies to text, setting whether the browser should insert line breaks within an otherwise unbreakable string to prevent text from overflowing its line box.