An email inbox on a laptop can show dozens of emails at once, one thin row each. The front page of a hotel booking app shows one big photo and one button. Both were made by people who know design, and both are right.
The difference is density: how much information fits on one screen. High density means tight rows and lots of content at once. Low density means generous spacing, with a little content shown large. Picture a phone book and a hotel brochure. The phone book packs hundreds of names onto one page, because people open it to find one name fast. The brochure has one big photo and three lines of text, because people open it to decide whether to stay. The phone book is an example of high density, the brochure of low density, and both are right for their own job.
Two pages, two densities
Mist Homestay now has two pages with different jobs:
- The guest page (choose a room): a guest has just arrived, doesn't know the rooms yet, and has to decide one thing. Low density: a big photo, a 24px room name, one room filling the screen.
- Mrs. Sri's dashboard (the owner's page with the December bookings): Mrs. Sri opens it every day to check who arrives when and to compare many rows. High density: tight rows, one booking per row.
The pattern holds in general. Analytics dashboards (pages of statistics), data tables, email inboxes and admin panels (pages for managing a site) suit high density, because their users search and compare. Landing pages (the first page people open from an ad or a link), promotional pages and onboarding (the welcome screens for new users) suit low density, because their users need to focus on one message.
| Context | Density | Why |
|---|---|---|
| Dashboards, data tables | High | Seeing and comparing lots of data at once |
| Product or room listings | Medium | Quick scanning, but each item still needs a photo and a price |
| Landing pages, onboarding | Low | One message, one decision |
Calculating rows per screen
Density can be calculated, not just felt:
visible rows = list area height ÷ row height, rounded down
Mrs. Sri's dashboard has a header (the title row above the list) 56px tall. On the laptop its list panel is 720px tall, so the area for the booking rows is 720 - 56 = 664px. On a phone the page area is 667px tall, so 667 - 56 = 611px is left.
Mrs. Sri has 16 bookings in December. If each row is 48px tall, are all 16 visible on the laptop without scrolling? Guess first, then check the table.
| Density | Row height | Phone (611px) | Laptop (664px) |
|---|---|---|---|
| Comfortable | 72px | 611 ÷ 72 = 8.49 → 8 | 664 ÷ 72 = 9.22 → 9 |
| Medium | 48px | 611 ÷ 48 = 12.73 → 12 | 664 ÷ 48 = 13.83 → 13 |
| Compact | 36px | 611 ÷ 36 = 16.97 → 16 | 664 ÷ 36 = 18.44 → 18 |
The answer: not all of them. With 48px rows on the laptop only 13 bookings show, and you have to scroll to see the other 3. With 36px rows, 18 rows fit, and all 16 bookings show at once: 16 × 36 = 576px, still under 664px.
In CSS, density is easiest to set with CSS variables, so one class changes every row. In this code, .bookings is the list of bookings. Each li (the tag for one list item) is one booking row:
.bookings { --row: 48px; --text: 16px; } /* medium */
.bookings.compact { --row: 36px; --text: 14px; }
.bookings.roomy { --row: 72px; --text: 16px; }
.bookings li {
box-sizing: border-box; /* the 1px bottom border counts inside --row */
height: var(--row);
font-size: var(--text);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
border-bottom: 1px solid #e2e8f0;
}
--rowand--textare CSS variables: names that hold one value, used in many places throughvar(...).--rowis the row height, and--textthe font size..bookings.compactapplies when the list also has the classcompact, and it only swaps those two variables. No row rule gets written again.box-sizing: border-boxcounts the 1px bottom border inside the row height (--row), so the rows-per-screen calculation stays exact.display: flexwithalign-items: centerandjustify-content: space-betweenputs the row's content in the middle of the row's height, and spreads it from the left edge to the right edge.
Scale: the hierarchy stays, the sizes follow
Scale means sizes and spacing follow the density while the order of importance (the hierarchy) stays the same. On the roomy guest page the room name is 24px and the price 16px bold. On the compact dashboard everything is 14px. So the order of importance is shown in other ways: the guest's name in weight 600, the room and dates in grey #475569, and the total right-aligned.
The order: lower the spacing first (72 to 48 to 36px), then the font size if you must (16 to 14px). 14px is the smallest size in the Mrs. Sri page's type scale (its list of font sizes), so even compact density doesn't go below it.
Density's lower limit on phones: touch targets
On a laptop people use a mouse, whose pointer tip is one pixel. On a phone they use a thumb. That's why touch targets (the areas you can tap) have a minimum size. Apple's guidelines ask for at least 44 × 44 pt, Material Design at least 48 × 48 dp, and WCAG 2.2 (criterion 2.5.8, level AA) at least 24 × 24 px. pt and dp are units of size in iPhone and Android apps. In a phone browser, 1 CSS px is roughly 1 pt or 1 dp.
A 36px compact row meets the WCAG minimum, but falls under Apple's 44 and Material's 48. So if a dashboard row can be tapped to open the booking details, use medium on phones (48px, 12 rows visible), and keep compact for the laptop.
⚠️ Dense in the wrong place
- One density for every page. A roomy dashboard makes Mrs. Sri scroll all the time. A compact guest page leaves guests unsure where to look.
- Going compact by shrinking text first. Reduce spacing first, and don't go below the smallest size in your type scale (14px here).
- Compact rows on phones. 36px looks neat, but it's easy to tap the wrong row. Check the 44 and 48 limits again.
- Mixing densities on one page for no reason. One roomy card in a compact list looks like a mistake, not emphasis.
TL;DR: Density is how much information sits on one screen. Analytics dashboards (pages of statistics), tables and inboxes use high density because their users compare lots of data. Landing pages (the first page people open from an ad or a link) and onboarding (the welcome screens) use low density because their users need to focus. Visible rows = area height ÷ row height, rounded down. A 664px area with 48px rows shows only 13 rows, with 36px rows 18. Set density with CSS variables, names that hold one value (--row, --text). Scale: the hierarchy (order of importance) stays, sizes and spacing follow the density. Lower the spacing first, then the font size. On phones, touch targets (the areas you can tap) should be at least 44pt (Apple), 48dp (Material), or 24px (WCAG 2.2 AA).
⚡ Density follows the page's job
Meaning: Density is how much information sits on one screen. Analytics dashboards (pages of statistics), tables and inboxes use high density because their users compare lots of data. Landing pages (the first page people open from an ad or a link) and onboarding (the welcome screens) use low density because their users need to focus on one message.
⚡ Count the rows per screen
Guess first: Mrs. Sri has 16 bookings in December. With 48px tall rows in a list area 664px tall, are all of them visible without scrolling?
No. 664 ÷ 48 = 13.83, so only 13 rows are visible. With 36px rows, 18 rows fit, and all 16 bookings show at once.
Meaning: Visible rows = area height ÷ row height, rounded down. Density can be calculated, not just felt.
⚡ One class changes every row
Write:
.bookings { --row: 48px; --text: 16px; } /* medium */
.bookings.compact { --row: 36px; --text: 14px; }
.bookings li {
box-sizing: border-box; /* the 1px bottom border counts inside --row */
height: var(--row);
font-size: var(--text);
}
Meaning: .bookings is the list of bookings, and each li (a list item) is one of its rows. --row (the row height) and --text (the font size) are CSS variables, and .compact (the compact list) only swaps those two variables. The hierarchy (order of importance) stays, the sizes follow the density. Lower the spacing first, then the font size, and never below the smallest size in the type scale (14px).
⚡ The lower limit on phones
Meaning: Touch targets (the areas you can tap) should be at least 44pt (Apple), 48dp (Material), or 24px (WCAG 2.2 AA). In a phone browser, 1 pt and 1 dp are roughly 1 CSS px. A 36px row only meets the WCAG minimum, so if rows can be tapped, use 48px on phones.