What is the "line-height" property in CSS?
Assesses fundamental understanding of HTML & CSS conventions, runtime behavior, and memory/performance considerations.
Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.
The line-height property defines the height of an inline line box, determining the vertical distance between baselines of consecutive lines of text:
### Value Formats:
- Unitless Number (Best Practice):
body { line-height: 1.5; }
A unitless number acts as a proportional multiplier of the element's current font-size. Child elements inherit the multiplier rather than a fixed computed pixel size, preventing text overlapping if children declare larger font sizes.
- Lengths (
px,rem):line-height: 24px;(Rigid, breaks on dynamic font scaling). - Percentages (
150%): Can cause inheritance calculation issues in nested headers.
Candidate Response Strategy & Interview Tips
- Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
- Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
- Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
- Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.