The height property sets the vertical size of an element. By default it defines the height of the content area. With box-sizing: border-box, it defines the height of the border area instead.
It is not inherited. The initial value is auto. min-height and max-height can override it. For logical sizing in writing modes, see block-size.
Accessibility.
Fixed heights can clip text when users zoom. Prefer auto or min-height when content may grow.
Content drives size. More text means a taller box.
Safer for zoom. Less risk of clipping when users enlarge text.
Pair with min-height. Keep a floor while still allowing growth.
Edge Cases & Pitfalls
Most height bugs come from percentages or clipping.
percent
Percentage needs a parent height
If the containing block height depends on content (auto), a child height: 50% usually becomes auto.
box
box-sizing changes what height means
With border-box, padding and border are included inside the height. With content-box, they add outside it.
override
min-height / max-height win
Those properties override height when they conflict. Check them if a box will not shrink or grow as expected.
inline
Non-replaced inlines ignore height
A plain span does not take height. Use a block, flex item, or replaced element.
a11y
Fixed height can clip text
When users zoom, fixed heights may hide content. Prefer flexible sizing for text-heavy boxes.
Compatibility
Browser Support
height is a browser layout property. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
height
Length, percentage, and auto work everywhere. Keywords like fit-content are widely supported; stretch is newer and limited.
99%Common values
Google Chrome1+
Full
Mozilla Firefox1+
Full
Apple Safari1+
Full
Microsoft Edge12+
Full
OperaSupported
Full
Samsung InternetSupported
Full
Internet Explorer4+
Full
heightWidely supported
Bottom line: Safe for everyday sizing. Treat stretch as progressive enhancement until support is broad.
Remember
Key Takeaways
Role: set how tall a box is (content or border box, depending on box-sizing).
Common values:auto, lengths, and percentages.
Initial value:auto. Not inherited.
Percent tip: parent needs an explicit height, or the % often becomes auto.
One line:height controls how tall the box is — auto from content, or a length / percentage you choose.
Frequently Asked Questions
It sets how tall an element is. By default it sizes the content area; with box-sizing: border-box it sizes the border area.
The initial value is auto. The browser sizes the box from its content and layout rules.
A percentage height needs a containing block with an explicit height. If the parent height is auto, the percentage usually computes to auto.
height sets a preferred height. min-height sets a floor so the box can still grow with content. max-height sets a ceiling.
Yes. With content-box (default), height is the content only. With border-box, height includes padding and border.
It is Baseline and widely available in all major browsers. Newer keywords like stretch have limited support. It is a browser layout property, not a Node.js feature.