CSS Width and Height — a practical guide to CSS width height with clear examples you can reuse in real projects.
CSS Tutorial Series (22/109). Prefer one article? Read the complete CSS tutorial.
Short description
Prefer min-height over fixed height for text content to avoid overflow.
Sizing
.box {
width: min(100%, 40rem);
min-height: 12rem;
}