Loupely Lens
How it works What it captures Compare Pricing Blog
Join the waitlist
How it works What it captures Compare Pricing Blog Join the waitlist
Skip to content
The image features a circular purple logo with a camera lens icon and the text "LoupeLy Lens" in a modern font. The logo is centered and includes a small dot representing the camera lens.

Loupely Lens

  • About
  • Acceptable Use Policy
  • Auth-Callback
  • Blog
  • Changelog
The image features a circular purple logo with a camera lens icon and the text "LoupeLy Lens" in a modern font. The logo is centered and includes a small dot representing the camera lens.
Loupely Lens
Popular Search chrome
  • All
  • A
  • B
  • C
  • D
  • E
  • F
  • G
  • H
  • I
  • J
  • K
  • L
  • M
  • N
  • O
  • P
  • Q
  • R
  • S
  • T
  • U
  • V
  • W
  • X
  • Y
  • Z
  • Home
  • Encyclopedia
  • B
  • Box Model

Box Model

< 1 min read

The box model is how browsers calculate the physical space every HTML element occupies on a page. Every element is treated as a rectangular box made up of 4 layers, from the inside out: the content area, padding, border, and margin.

Content is the actual text or image. Padding is the transparent space between the content and the border. Border is the line around the element (which may be invisible, but it still exists and takes up space). Margin is the transparent space outside the border, which separates the element from its neighbors.

The box model is why elements don't sit exactly where you expect them to, and why changing padding in one place can shift everything around it. There's also a behavior called margin collapsing: when 2 elements with vertical margins are adjacent, the browser doesn't add the margins together. It uses only the larger of the 2 values. So setting a 40px bottom margin on one element and a 40px top margin on the next element doesn't give you 80px of space. It gives you 40px. This counterintuitive behavior produces spacing results that look like bugs but are actually specified CSS behavior.

© 2026 Loupely Lens - WordPress Theme by Kadence WP

Loupely Lens The only CSS tool that tells you why your change didn't work. Every other tool copies styles. Lens diagnoses them.
Loupely Lens
How it works What it captures How Lens compares Pricing
Resources
Knowledge base Roadmap Changelog
Company
About Blog Indie Hackers
© 2026 Loupely LLC. Built by Joyce Akiko.
Privacy Terms
  • About
  • Acceptable Use Policy
  • Auth-Callback
  • Blog
  • Changelog