3 ms·
>Trying to learn to develop simple UIs, but just keep hitting my head against CSS. It just does not click. What is there to click? Start doing it and you'll ge
by coldtea 3y ago
>Trying to learn to develop simple UIs, but just keep hitting my head against CSS. It just does not click.
What is there to click? Start doing it and you'll get in a few weeks time.
In 2023 there has never been an easier time for CSS. Back 10 years ago, all kinds of hacks (floats, negative margins, etc) were needed. Now it's 99% smooth sailing.
- solardev 3y agoCSS is better than it was, but it's still a mountain of hacks on top of hacks, needing to conform to an HTML that was and is still largely designed for blog-like documents, not multi-screen, responsive app UIs. Something as common as a combobox* (a textbox + dropdown, ideally with autocomplete) is still a pain to implement, requiring understanding positioning, anchoring, z-indices, scrollbars (and how they're different across operating systems), media queries, word-wrapping, box sizing, etc. And that's just the CSS side. On the HTML and JS sides there's dynamic loading from the server (and what to do with clientside state in the meantime, loading indicators, etc.), accessibility, focus locking, blah blah. Meanwhile, like 15 years ago that was a drag-and-drop WinForms control in Visual Studio. It's "99% smooth sailing" if you work in it day and in day out, maybe, and are aware of all its quirks. But easy to learn it is not... -------------- * If you want to see some of the complexity, take a look at a published combobox component like MUI's: https://mui.com/material-ui/react-autocomplete/#combo-box https://mui.com/material-ui/react-autocomplete/#combo-box Basic usage just requires a few lines of React, but the options and different behaviors are pretty complex, both in JS and in CSS. You can of course write something like this from scratch, it's just a lot more work than, say, a blog post.
- coldtea 3y ago>Something as common as a combobox (a textbox + dropdown, ideally with autocomplete) is still a pain to implement, requiring understanding positioning, anchoring, z-indices, scrollbars (and how they're different across operating systems), media queries, word-wrapping, box sizing, etc. And that's just the CSS side.* Or you can just use one of the 20000 available such components. A combobox is a pain to implement in native code without a GUI library too.
- curtisblaine 3y agoIt very much is not. One example: to prevent your flex container with an height from expanding to more than that height, you need to set the min-height to 0. There is surely a good reason for that (I know there is, and I don't care why it is technically necessary), but this means that to use a very modern layout mechanism (flex) in a way that makes sense for the user (e.g. you want an app that is limited to the height of the page) you need to use another css rule that doesn't make apparent sense for a reason that you can understand only if you have a deep grasp on CSS in its entirety.