Live data from Hacker News

The State of CSS 2019

2019.stateofcss.com

51–60 of 68 posts

Re: The State of CSS 2019

#51
Given the results on layout tools:

Grid - 54.5% have used it, 43.2% heard of it, but haven't used it

Flexbox - 94.4% have used it, 4.64% heard of it, but haven't used it

...I wonder how the adoption of CSS grid will play out over time. Are people comfortable enough with flexbox that they don't feel the need to use CSS grid?

Re: The State of CSS 2019

#52
> JavaScript has developed a bit of a reputation as the angry, rebellious teenager going through a new phase every year and telling you you're just too old to understand.

Couldn't agree more.

I imagine one of the many reasons is because CSS features can't be transpiled but many of JS can.

Re: The State of CSS 2019

#53
post #29

I think the most offensive thing here is that 6.2% of people use inches as a unit of measure in their css. The thought of 𝚋𝚘𝚛𝚍𝚎𝚛: 𝟶.𝟸𝚒𝚗 𝚋𝚕𝚊𝚌𝚔; sitting in someone's css is terrifying.

As someone who hasn't done CSS in a while, with a 4K monitor and the knowledge how old pixel-based desktop apps look on it (VERY small), what's wrong with inches? From my own non-CSS based graphics experience, the only problem with layouts specified in absolute sizes is that small lines look really bad on standard (<100dpi) monitors if not aligned to the physical screen pixels. (Not saying that's not bad!)

On the web, inches don't actually work based on physical inches, they're just another pixel measurement. But assuming they did work on physical inches, they still wouldn't capture how close the device was going to be to your face, what the pixel density/brightness was, anything like that.

For the most part, use percentage, `em`, or `rem`. This is based off the the font size, which is more accessible (your app will still look good if someone with poor eyesight changes the font size). It'll also mean your app works well with fractional scaling out of the box. I believe that most desktop-level graphics frameworks like GTK support `em` units. At the very least, on the web, avoid pixel measurement in most cases.

It turns out that device font-size is a good measurement to capture most of the variable parts of user experience -- a pixel dense device that's held close to your eyes will have a small font size, a high resolution monitor that's farther away will have a larger font size -- and `em` will work great in both cases.

Re: The State of CSS 2019

#54
post #46
post #37

Earlier quoted context omitted.

> Want to use a semicolon on this line, and not one on the next? Go for it! Not the best when you want to write something production worthy. What do semicolons - or braces, for that matter - have to do with production worthiness? Style inconsistencies do not cause bugs. Poor CSS rules do.

Inconsistencies in the source file do not affect production worthiness in the moment, but they do affect maintainability down the line. If for instance your team wants to move to a new css preprocessor that's the next big thing in 10 years, a consistent style means you can programatically convert to the new syntax. Or maybe there's a tool that can help you write better css and detect where rules are unused -variable…

I wouldn't pick Stylus for a new project, but you can use it with a linter like Stylint (https://github.com/SimenB/stylint) to enforce stricter conventions. Totally agree with you on the importance of consistency for maintainability (where it can be applied automatically with tools).

Re: The State of CSS 2019

#56
post #42

Earlier quoted context omitted.

As someone who hasn't done CSS in a while, with a 4K monitor and the knowledge how old pixel-based desktop apps look on it (VERY small), what's wrong with inches? From my own non-CSS based graphics experience, the only problem with layouts specified in absolute sizes is that small lines look really bad on standard (<100dpi) monitors if not aligned to the physical screen pixels. (Not saying that's not bad!)

Inches in css aren't in any way related to physical inches. CSS has no knowledge of your physical screen dimensions. Rather an inch was defined early on in the history of css as "1 inch in pixels of a 17 inch screen at 1280x1024 resolution" This happens to be 96.42 pixels, which rounded down to 96. So not only is it an obscure unit, it's also a misleading one. On your 4k monitor 96 pixels is more than likely not an i…

That said, Mozilla did use to have the experimental `mozmm` unit that attempted to accurate represent the millimetre. However it was removed a few versions back.

Re: The State of CSS 2019

#57
post #36

> CSS on the other hand has always been the studious, well-behaved kid who always stays polite and never makes a rash decision This is such a strange picture to paint! CSS has always been the dim-witted kid. For a long time, it couldn't do math. For a long time, it couldn't have varibles. For a long time, it did not have a reasonable syntax for page layout. Its rules have global visibility (if we don't consider shado…

For a long time, it didn't need any of those things. It's only been a recent need for marketing, mainly.

Not even close. Marketing has lead to some absurd uses of CSS but it's more about adaptive/responsive design.

When you need to handle an almost unlimited range of screen sizes having your visual system able to handle a little math is critical.

Re: The State of CSS 2019

#58

Earlier quoted context omitted.

As someone who hasn't done CSS in a while, with a 4K monitor and the knowledge how old pixel-based desktop apps look on it (VERY small), what's wrong with inches? From my own non-CSS based graphics experience, the only problem with layouts specified in absolute sizes is that small lines look really bad on standard (<100dpi) monitors if not aligned to the physical screen pixels. (Not saying that's not bad!)

On the web, inches don't actually work based on physical inches, they're just another pixel measurement. But assuming they did work on physical inches, they still wouldn't capture how close the device was going to be to your face, what the pixel density/brightness was, anything like that. For the most part, use percentage, `em`, or `rem`. This is based off the the font size, which is more accessible (your app will st…

> But assuming they did work on physical inches, they still wouldn't capture how close the device was going to be to your face

At least the inch is a unit whose physical size, by the name, you could assume to not change when screen resolution changes. And also, DPI (or just the physical monitor size) is usually something the user can configure in the operating system - to account for viewing distance or personal preferences.

Re: The State of CSS 2019

#59
post #46
post #37

Earlier quoted context omitted.

> Want to use a semicolon on this line, and not one on the next? Go for it! Not the best when you want to write something production worthy. What do semicolons - or braces, for that matter - have to do with production worthiness? Style inconsistencies do not cause bugs. Poor CSS rules do.

Inconsistencies in the source file do not affect production worthiness in the moment, but they do affect maintainability down the line. If for instance your team wants to move to a new css preprocessor that's the next big thing in 10 years, a consistent style means you can programatically convert to the new syntax. Or maybe there's a tool that can help you write better css and detect where rules are unused -variable…

Clear and consistent code formatting guidelines (and ideally automatic formatting for this) is also great for reducing the thought required in formatting code you push while reducing noise and code formatting debates in code reviews.

Re: The State of CSS 2019

#60
post #42

Earlier quoted context omitted.

As someone who hasn't done CSS in a while, with a 4K monitor and the knowledge how old pixel-based desktop apps look on it (VERY small), what's wrong with inches? From my own non-CSS based graphics experience, the only problem with layouts specified in absolute sizes is that small lines look really bad on standard (<100dpi) monitors if not aligned to the physical screen pixels. (Not saying that's not bad!)

Inches in css aren't in any way related to physical inches. CSS has no knowledge of your physical screen dimensions. Rather an inch was defined early on in the history of css as "1 inch in pixels of a 17 inch screen at 1280x1024 resolution" This happens to be 96.42 pixels, which rounded down to 96. So not only is it an obscure unit, it's also a misleading one. On your 4k monitor 96 pixels is more than likely not an i…

> On your 4k monitor 96 pixels is more than likely not an inch (unless your monitor is slightly over 42 inches)

That's good to know. My 4k monitor, coincidentally, is about 40.5 inches, so CSS inches are displayed almost correctly.

Post reply on HN