The Height Enigma The article explains that in CSS, percentage-based heights often fail because they create a circular calculation: a child element's percentage height depends on its parent's height, but the parent's default height depends on its children. To make `height: 50%` work, the parent must have an explicit, fixed height (e.g., using `px` or `rem` units) so the browser can resolve the child's percentage value. Once a fixed height is established, nested percentage-based heights can be calculated successfully. Back when I was first trying to understand CSS, one of the biggest mysteries to me was why height sometimes wouldn’t work. For example: Code Playground Result I’ve given this paragraph height: 50% , but as you can see, it hasn’t grown at all In fact, it doesn’t matter whether I set height: 100% or height: 10000% or height: 0% . Nothing happens. In my first few years with CSS, I developed a bit of an intuition for when it would work and when it wouldn’t, but it always sorta felt like rolling the dice. Sometimes it wouldn’t work even when it really seemed like it should Like with so much in CSS, it feels random until you learn about the underlying mechanisms that explain the behaviour, and then it all makes perfect sense. In this blog post, we’ll learn what’s going on here and I’ll share how I solve these sorts of problems. Link to this headingA circular calculation So here’s the core thing to know: in CSS, width and height are fundamentally different. By default, they’re calculated in totally opposite ways. This becomes obvious when we really think about it. Block-level elements like