Live data from Hacker News

Relearn CSS layout

every-layout.dev

71–80 of 187 posts

Re: Relearn CSS layout

#71

Earlier quoted context omitted.

> if I am using the right elements and pay attention to the structure of my content it just naturally styles itself with CSS Grid Why is that? Does Grid treat 'article'and 'section' differently than it treats plain 'div'? I thought that the purpose of 'article' etc. was purely semantic, saying something about the meaning and purpose of content inside them, not how they should be laid out on the page.

What I have learned just from having a go is that document outlines matter too, so I just think of whatever I am writing in terms of sections, articles and asides. I don't actually ever think of adding a 'div', there is just no actual use case for them. Typically with a 'section' the first line inside it for me is a heading. So on the outline there are no 'unnamed sections'. Save with 'nav' and other content blocks,…

If seems like you discount portability as a concern, and if that's appropriate for your use case, that's a fair decision of course. But there are many use cases for which that's a priority.

The concern the BEM and component-based CSS approaches aim to address is the composition of arbitrary chunks of DOM without implicit side effects. By having chunks of DOM explicitly opt in via classes to being styled in a given way, they never accidentally receive styles they weren't meant to, and they're fully portable to arbitrary contexts.

In something like an web application as opposed to a document-oriented website, the ability to compose components and avoid quirks of things that randomly break or look different inside other things is beneficial. Using a component in a new place shouldn't (in the application development context) require adding new selectors for it because it's not "where" your selectors expected it to be.

Re: Relearn CSS layout

#72
post #66

To me this way to CSS development is outdated. I will never program like this anymore. I only do functional/utilitarian CSS.

CSS has been a bit of a mess for ages.

It never scaled terribly well in its original state, and with every iteration became more bloated, so we came up with methods of controlling the sprawl; but imo glut of Modern CSS Implementations and their many and varied permutations not only feel like they are not only fighting against the original concepts, but also against each other.

Which isn't to say they're bad or anything, but simply that CSS is old, everything else has changed dramatically, its probably time we went back to the drawing board.

Re: Relearn CSS layout

#73
To me an evident thing in UI development is that separating stylesheet from layout isn't really a thing anymore and the benefits of this separation aren't really that clear.

Things like SwiftUI and React are showing that declarative UIs can be built by tying the style to the layout and allow for much better accessibility, tooling, overall thinking of how UIs work.

So to me CSS feels a bit outdated since big companies are definitely moving away from this separation. How does HN feel about this?

Re: Relearn CSS layout

#74
post #73

To me an evident thing in UI development is that separating stylesheet from layout isn't really a thing anymore and the benefits of this separation aren't really that clear. Things like SwiftUI and React are showing that declarative UIs can be built by tying the style to the layout and allow for much better accessibility, tooling, overall thinking of how UIs work. So to me CSS feels a bit outdated since big companies…

This is not quite necessarily true - I work at a tech giant and we've opted for using scss still & are quite happy with our choice.

Re: Relearn CSS layout

#75
post #74
post #73

To me an evident thing in UI development is that separating stylesheet from layout isn't really a thing anymore and the benefits of this separation aren't really that clear. Things like SwiftUI and React are showing that declarative UIs can be built by tying the style to the layout and allow for much better accessibility, tooling, overall thinking of how UIs work. So to me CSS feels a bit outdated since big companies…

This is not quite necessarily true - I work at a tech giant and we've opted for using scss still & are quite happy with our choice.

Is your company actually building a platform for developers to build apps? Because that's what Apple is doing and they shifted away from using paradigms like CSS.

Re: Relearn CSS layout

#76
post #75
post #74

Earlier quoted context omitted.

This is not quite necessarily true - I work at a tech giant and we've opted for using scss still & are quite happy with our choice.

Is your company actually building a platform for developers to build apps? Because that's what Apple is doing and they shifted away from using paradigms like CSS.

CSS is not a paradigm. Whatever workflow you have for styling your pages and apps, it's all CSS in the end.

Re: Relearn CSS layout

#77
post #76
post #75

Earlier quoted context omitted.

Is your company actually building a platform for developers to build apps? Because that's what Apple is doing and they shifted away from using paradigms like CSS.

CSS is not a paradigm. Whatever workflow you have for styling your pages and apps, it's all CSS in the end.

CSS can certainly be described as a paradigm. It's a model you follow to style things on the web.

It also doesn't matter if it's all CSS in the end. At one particular end it's all manipulating assembly instructions, but I wouldn't call styling pages writing assembly. That is to say the underlying model or paradigm (styling in this case) doesn't really matter if you build an abstraction on top of it that hides that paradigm.

Re: Relearn CSS layout

#78
post #76
post #75

Earlier quoted context omitted.

Is your company actually building a platform for developers to build apps? Because that's what Apple is doing and they shifted away from using paradigms like CSS.

CSS is not a paradigm. Whatever workflow you have for styling your pages and apps, it's all CSS in the end.

CSS is absolutely a paradigm. Not the specific style rules that exist in browsers, but the idea of selectors, specificity and stylesheets.

The fact that it's possible to define layout and styling using just style properties is the giveaway.

Re: Relearn CSS layout

#79
post #66

To me this way to CSS development is outdated. I will never program like this anymore. I only do functional/utilitarian CSS.

NOTE: I think this refers to the approach implemented by libraries like: * https://tailwindcss.com/ * http://tachyons.io/

Also: * http://minid.net/2019/04/07/the-css-utilitarian-methodology/ * https://github.com/meerita/utilcss

Re: Relearn CSS layout

#80

What’s the best resource (book, videos etc.,) to learn css these days?

I have heard lots of good about "CSS in depth" by Keith J. Grant. It explains why and how CSS does things, rather than just telling you to do one thing for that use case, and another thing for that use case. It is meant for people who already know a bit of CSS, but it wouldn't be too hard to learn the basics of CSS first then read this book. Also, it is free online on the publishers page, which is extremely generous of him and the publisher.

https://www.manning.com/books/css-in-depth

Post reply on HN