If a block should fill at least the viewport-height area and expand when its text gets longer, replace height: 100% with min-height: 100%. A percentage height sets a height relative to the containing block; it does not mean “fill the screen, then grow with all content.”
Why the div stops growing
In the SitePoint forum example, the page sets html and body to height: 100%, then gives a child div height: 100%. The block looks right with a few lines, but longer text extends beyond its set height rather than making that height increase.
That is the distinction between a specified height and a minimum height. height: 100% asks for a height based on the containing block. The W3C CSS Box Sizing specification states that percentages are resolved against the corresponding dimension of the containing block. A height declaration is not a promise to keep stretching as content grows.
Percentage heights also depend on the containing block’s height being resolvable. Under the CSS 2.1 percentage-height rule, when a non-absolutely positioned element’s containing-block height is not explicitly specified and depends on content, its percentage height computes to auto. So check the relevant parent heights rather than assuming height: 100% automatically means viewport height.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
Use min-height when content should make the page taller
For the forum example’s apparent goal—a green block at least as tall as the viewport-sized ancestor, but able to grow with longer text—use:
html, body {
height: 100%;
}
div {
min-height: 100%;
max-width: 18.75em;
background-color: #008000;
}
min-height: 100% sets a floor: the block can be at least as tall as its containing block, and its content can make it taller. The forum replies recommend it in place of height: 100% for this content-growing case, and caution against fixed heights on elements holding fluid text.
Choose sizing by the behavior you want
- Natural content growth: use
min-heightwhen the block should fill a minimum area and grow as needed. - Fixed panel: use a fixed
heightwhen the design calls for a bounded panel, and choose an explicit overflow behavior such as scrolling or clipping. - Percentage height in a nested layout: inspect the containing block and its ancestors. A percentage needs a usable reference height; content-sized ancestors can change how it resolves.
The SitePoint thread concerns a simple block in ordinary page flow and dates to August 2018; it does not establish behavior across every layout context or browser. If the element is inside a grid, flex, positioned, or otherwise nested layout, verify the containing block and the intended overflow behavior for that layout.
Quick Recap
Best Value
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Rank #4
Rank #3
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems




