7 ms·
CSS is such a weird abstraction. Who thinks in blocks and inline blocks? Who thinks in paddings and margins? Floats, etc? I know these are more flexible, but I'
by jb3689 6y ago
CSS is such a weird abstraction. Who thinks in blocks and inline blocks? Who thinks in paddings and margins? Floats, etc? I know these are more flexible, but I've always found grid-based frameworks to be far more intuitive
- tenuousemphasis 6y agoYou can construct a grid based system based on a block system, but wouldn't the reverse be much more difficult?
- robertoandred 6y agoAn off-the-shelf grid system is too inflexible, and you spend more time customizing it or fighting it to get the result you need than you would have just building what you need.
- Sharlin 6y agoCSS is a very reasonable abstraction for the job it was originally designed for: layouting of mostly textual documents. As such it borrows its concepts from the desktop publishing world. Margin and padding make absolute sense when you think in terms of headings and paragraphs. Float is an established term for having text flow by an image or other rectangular insertion. And so on. You have to remember the context in which CSS was first conceived. The Web looked quite different then.
- IggleSniggle 6y agoDear lord it's 2020 CSS has its own grid system, it's CSS Grid, and it's both easier to understand and more flexible than adopting the old frameworks. It also has variables, pseudo-selectors (which, like with html elements, you can invent new ones to suit your purposes), and more.
- benrbray 6y agoIs creating your own pseudo-selectors really possible? I like to think I'm pretty up to date on modern CSS but I've never heard of this.
- runarberg 6y agoI might be wrong but I think GP is talking about shadow parts[1] my-element::part(custom-selector) { /* ... */ } 1: https://developer.mozilla.org/en-US/docs/Web/CSS/::part https://developer.mozilla.org/en-US/docs/Web/CSS/::part
- deleted 6y ago[deleted]
- IggleSniggle 6y agoWell, I wouldn't recommend it, but certainly you can programmatically apply a pseudo-element or pseudo-class and programmatically define behavior around those things.