Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I love absolutely love flexbox. This is super opinionated and based on the types of software I'm typically exposed to.

I think most people just don't understand how to get the most out of it in terms of creating user interfaces, and use "table" oriented thinking like percentage widths and media size queries to control overall layout.

I think you should use it the way that something like QT's BoxLayout and GridLayout containers work. Strictly using flex-grow and min-width, max-width and justify-content to control layout. I can design just about any interface with just these CSS classes, with very occasional use of the three properties above:

    .VBox    { display: flex; flex-flow: column nowrap; }
    .HBox    { display: flex; flex-flow: row nowrap;    }
    .VGrid   { display: flex; flex-flow: column wrap; align-items: flex-start; }
    .HGrid   { display: flex; flex-flow: row wrap;    align-items: flex-start; }
    .Grow    { flex-grow: 2; }


There's a project called Sciter that uses a sub/superset of CSS and HTML to create native apps. They have their own flow styling for this, and boy is it nicer than flexbox: https://terrainformatica.com/w3/flex-layout/flex-vs-flexbox.... More details here: https://terrainformatica.com/2018/12/11/10-years-of-flexboxi...

I know the author pitched this as an idea to w3c a while back, but I don't know why it was rejected in favor of flexbox.


What I like about my style, is that the document structure enforces the layout structure. The two are much more closely bound, and with this style, you can perform arbitrary levels of subdivisions of your containers.

Working off your last link, the final "holy grail" example, with less style but the same exact layout: https://jsfiddle.net/Lpedja35/

You don't have to have a matrix with an artificial rank to represent this. I only need to specify the 1 and 4 rows once. I don't have to make a square and then decide how to divide it, which, is the "table thinking" I mentioned earlier. I just observe which elements need Grow and then design from the inside out.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: