4 ms·
Still surprised it took so long. Feels like the folks working on CSS have some really weird prioritites when it comes to deciding what to work on and what to ad
by CM30 2y ago
Still surprised it took so long. Feels like the folks working on CSS have some really weird prioritites when it comes to deciding what to work on and what to add.
- eyelidlessness 2y agoVertical centering has been trivial in numerous ways for many years. At least since flexbox. This is mostly a convenience to achieve what flexbox already did, with a simpler (albeit more error prone) imposition on document structure. With that in mind, which “really weird priorities” would you have deprioritized relative to this convenience?
- The_Colonel 2y agoIndeed, since at least 1997, when HTML 3.2 standardized tables.
- Levitz 2y agoI don't think it's fair to dismiss something as "convenience". Convenience is very important in development, convenience is the reason we use CSS to begin with. The idea of centering an element within another is extremely basic. Something someone might want to do literally within the first 30 minutes of touching CSS for the first time and historically that person, who probably expected some evident answer instead found a 5000 vote post in stackoverflow with information on flexbox, margin auto, text align and half a dozen hacks for different situations. Like I can do a js implementation of array.has() in a couple of minutes. I would still be shocked if it was never implemented by default and it got implemented now.
- eyelidlessness 2y agoAll of what you say is reasonable, as written. But I also don’t think it’s fair to characterize my comment as dismissing convenience. I think “really weird priorities” is a strong claim, and I think it deserves perspective and warrants questioning.
- throwitaway1123 2y agoI'm also frequently surprised at how long certain CSS features take to implement. Some recent examples for me are the `has:()` pseudo selector [1], the scripting media queries [2], and css nesting [3]. [1] https://caniuse.com/css-has https://caniuse.com/css-has [2] https://caniuse.com/mdn-css_at-rules_media_scripting https://caniuse.com/mdn-css_at-rules_media_scripting [3] https://caniuse.com/css-nesting https://caniuse.com/css-nesting
- extra88 2y agoThe `scripting` @media query isn't very useful. If you want CSS that's in effect when the browser doesn't have JavaScript, you can put those styles inside <noscript>. More commonly, use JavaScript itself to add or remove a class that is used within the relevant selectors. Only using JavaScript itself is potentially effective when script-blocking extensions are used rather than JavaScript not being available at all. `:has()` is very clever, powerful, and has been desired for a long time. However, even if someone figured out how to implement it twenty years ago, it probably still couldn't have been used for performance reasons. CSS nesting may have also been infeasible for performance reasons.
- throwitaway1123 2y ago> The `scripting` @media query isn't very useful. If you want CSS that's in effect when the browser doesn't have JavaScript, you can put those styles inside <noscript>. If your styles are defined within external stylesheets, then having to extract them from their respective stylesheets and place them directly in a noscript DOM node is not very ergonomic (and it will also affect your ability to cache those styles, since they're now a part of your potentially dynamically generated HTML rather than a static stylesheet). > use JavaScript itself to add or remove a class that is used within the relevant selectors. Well yeah, If you're ok with adding JS then most native CSS features can be polyfilled. This is a very imperative solution to a problem that the scripting media query handles declaratively. I would much rather have my styles dictated by my stylesheets, and reserve my JS for adding interactivity. > However, even if someone figured out how to implement it twenty years ago, it probably still couldn't have been used for performance reasons. Yeah the has selector is similar to a lookahead assertion in a regular expression, and CSS nesting is similar to a lookbehind (both of which can be computationally expensive). I'm not sure browsers needed to wait until the 2020s to deliver these features though. I would have loved to ditch SASS and SCSS years ago.