4 ms·
Isn't @supports slightly redundant, though? Unless you're avoiding a broken feature, CSS will simple cascade down with the first supported property by default.
by ry_ry 10y ago
Isn't @supports slightly redundant, though?
Unless you're avoiding a broken feature, CSS will simple cascade down with the first supported property by default.
It's how we've handled browser prefixing, background gradients, wonky flexbox and pretty much everything since forever.
Im sure it'll be an unpopular opinion, but whilst I can see some edge cases where you only want to apply certain ancillary css if your markup is going to be rendering in a certain way, I honestly can't think of many (any?) real world usecases where you're not pretty much frigging it to provide 2005-tier browser sniffing.
- sleazy_b 10y agoThis is what the author herself says in the article. Specifically, that feature queries should be used when you only want to apply a set of styles if a given feature is supported.
- ry_ry 10y agoBut surely that is in itself counter to how css is supposed to work at a very fundamental level? If you want to render different content for different browsers, I'm not convinced that is a function of stylesheets, not should it be. If my layout needs extra padding or whatever if a div is a flexbox, rather than display:table, I would consider that to be an implementation issue rather than something I would want to cover with additional code. I might just be completely missing the point, but it feels like a bandaid.
- untog 10y agoIt's a total bandaid, but that's the point. If the browser lets you sanely style things with display:grid, then you can. But you can have a fallback for browsers that don't support it.