I'm trying to lay out my page precisely by specifying CSS attribute values in pixels. However, in one instance where I'm trying to limit the maximum number of tiles per row in a tiled display, I'm finding that my calculations are off by a puzzling, unknown (to me) factor.
The following two fiddles illustrate my question:
- Good fiddle: A max of two tiles are displayed per row in the left column. But I don't understand why the
max-width
attribute of my container has to be greater than the sum ofmargin + border + padding + width
for the content tiles. - Bad fiddle: I'm not getting the 2-tiles-per-row output I want, despite specifying what I believe to be precisely calculated box model attributes for the content and container elements.
What am I missing in my calculations? Why is margin + border + padding + width
for the inner tiles not adding up exactly to my max-width
for the container?