Re:CSS hack: Predictable block elements
by gojomo on Friday July 13, 2012 @03:54AM
(#4238713)
Sounds reasonable, but are there any downsides to consider before adopting...
everywhere...?
[ Parent
| on HN ]
Re:CSS hack: Predictable block elements
by garethadams on Friday July 13, 2012 @04:26AM
(#4238825)
It means that a 300px wide image won't fit inside a 300px wide box any more.
You need to decide whether your sizing for each element depends on your layout or your content, and choose accordingly. If one way is more useful to you nearly all of the time, then use it that way.
However, also be aware that the star rule is the least performant rule in CSS (http://stackoverflow.com/questions/1714096/why-is-the-css-st...).
Not according to Paul Irish: http://paulirish.com/2012/box-sizing-border-box-ftw/
The biggest downside is that its only supported in IE8+
If you use it sparsingly, like on specific div's only - and you can do that, because box-model:border-box only _really_ matters and is _really-really_ good when dealing with percentage widths, you can fix it with 'behaviour' and css calculations. Done that.
Re:CSS hack: Predictable block elements
by Hovertruck on Friday July 13, 2012 @10:15AM
(#4239876)
We use it for the Chartbeat dashboard (demo here: http://chartbeat.com/demo/) and it's been delightful, but we also made the decision while we were already doing a redesign. This meant we weren't just adding another rule to the page which would change everything; we wrote new CSS with this concept in mind.
Re:CSS hack: Predictable block elements
by ricardobeat on Friday July 13, 2012 @04:25AM
(#4238821)
1. The * selector is slow
2. No IE < 8 support
Apparently it is not the case that the * selector is slow, see Paul's article.
>> You might get up in arms about the universal * selector. Apparently you've heard its slow. Firstly, it's not. It is as fast as h1 as a selector