5 ms·
The W3C box model would only be useful if the W3C also provided a way to specify a width as "percentage of parent box width minus a fixed number of units" to co
by kbolino 15y ago
The W3C box model would only be useful if the W3C also provided a way to specify a width as "percentage of parent box width minus a fixed number of units" to compensate for the padding adding to the total width.
However, they did not, which means that in order to make a decent flowing layout, you have to change your document markup to insert artificial and otherwise unnecessary elements (DIV tags usually).
Thus the original model was flawed, did not make sense, and ultimately was not consistent with their own stated goals (separation of content and style).
[edit: FWIW petenixey said essentially the same thing, and what's really clever is that he said it first.]
- deleted 15y ago[deleted]
- bzbarsky 15y agoAt this point the W3C is in fact working on providing such a thing. "width: calc(50% - 20px)". Works in Firefox and IE. At some point WebKit will catch up, I assume.
- kbolino 15y agoI'm glad to hear that, but it's long overdue and the border-box model already solves the same problem with less markup (and most importantly, without creating an implicit dependency between the padding and width styles).
- bzbarsky 15y agoWell, in all fairness calc() lets you solve a bunch of problems that border-box can't solve.