5 ms·
CSS without float.. would not work very well! Unless we all go back to table based design (or ahead to flexbox I guess, I don't know enough, practically speakin
by dingdingdang 13y ago
CSS without float.. would not work very well! Unless we all go back to table based design (or ahead to flexbox I guess, I don't know enough, practically speaking, about that standard yet to reason proper about it though!)
- ehsanu1 13y agoIf you clear your floats, you'll be fine in terms of giving the engine room to parallelize, according to pcwalton's blog post.
- oneeyedpigeon 13y agoDoes that 'allow' the classic use case of floats - potentially, what should be the only use of floats - wrapping text around an image? I feel like the answer would be "no", yet there's no good alternative for achieving this common requirement, which would cause a snag.
- ehsanu1 13y agoI believe you're right. But I don't think this is a huge problem: you simply don't get the benefits of layout out that specific text in parallel, it'll render sequentially as browsers tend to do today anyways. You can still get parallelization in other flows outside of the container of the floating elements.
- azakai 13y agoI believe it does, yes. The point is that when you clear them later, the browser has a static guarantee that that float will not matter anymore. So the complexity due to the float is only relevant until the clear, and it can parallelize before and after the clear.
- pcwalton 13y agoIf you know you need to use floats to flow text around elements, feel free to use them! They're in CSS for a reason :) But if there are alternatives (such as absolute positioning) that work equally well in your particular design, then choosing an alternative may help you gain better performance.
- scotth 13y agoFlexboxes don't really help. The reason that floats exist is so that elements can flow around them.
- sjy 13y agoThat's what they were designed for, but they are frequently used to do things that would better be done with flexboxes (if the support was there).
- _greim_ 13y agoWired.com made (web) history by being one of the first major sites to deploy a pure-CSS design, which was based on floats because that's all that worked back in the days of Netscape 4 and IE 4. The web design community now primarily uses floats for multi-column design because of its historical browser support. However if you don't need to support IE7 and lower, floats are one tool among many for multi-col layout, and not necessarily the best. Flexbox will only add another tool to that toolbox.