A CSS percentage is a relative measurement: its size depends on a reference, rather than a fixed number of pixels. For an element’s width, that reference is its parent’s width—not necessarily the whole browser window. section 14.3 section 7.6
Seventy-five percent of what?
Suppose a parent is 800 pixels wide and its child has `width: 75%`. The child is 600 pixels wide, even if the browser window is 2,000 pixels wide. Want to size it relative to the window instead? Use a viewport unit. section 14.3
Percentages are handy for a liquid layout: widths and other horizontal measurements can change as the available space changes. That helps a page fit different screens without relying on fixed pixel widths. But fitting is not the same as being readable; columns can still become too narrow on a phone. section 14.12 section 14.3
A few practical choices:
- Try percentages for horizontal widths, padding, and margins; use rem units when those spaces need tighter control. Percentage padding or margins can produce surprising results because they relate to the parent’s width. section 14.11
- Use rem units for vertical spacing. For a layout that needs to change its arrangement at different screen sizes, add media queries; percentages alone will not fix cramped columns. section 14.11 section 14.12
.container {
max-width: 60rem; #1
}
header {
padding: 1rem 1.67%; #2#3
}
h1 {
padding-left: 1.67%; #3
}
.quotation {
padding-right: 1.67%; #3
}
article {
flex-basis: 20rem;
padding-top: 1rem;
padding-left: 1.67%;
}
p {
margin-bottom: 1rem;
}
aside {
flex-basis: 10rem;
padding: 1rem 1.67%;
}
div {
padding-bottom: .5rem;
}
footer {
padding: 1rem 1.67%;
}
See percentages used for horizontal padding alongside rem units for vertical spacing and controlled widths. section 14.11



