Earlier quoted context omitted.
but i don't know if 10em is too much or too small. that's the point. i don't want a specific width defined
Then you can use 1fr 10fr or any ratio you want.
Show HN: Struggle with CSS Flexbox? This Playground Is for You
111–120 of 120 posts
Re: Show HN: Struggle with CSS Flexbox? This Playground Is for You
#112In my opinion, flexbox is simple and makes a lot of sense. The problem is that its properties and values were named by a committee, so they aren't intuitive to anyone who wasn't involved in the long proceedings that led up to the spec being written. You try to remember which one is justify-content, which one is align-items, and so forth, and just give up and try everything until something seems to work.
There are myriad “how to flexbox” but never seen good “how to grid” in my experience - I despise grid and have never intuitively gotten the hang of it and 95% of the time flexbox will work better and is easier anyway Just my $.02
Whereas the "ASCII diagrams" of grid-template-areas, especially, I think is one of the most intuitive things in recent CSS. The majority of Grid CSS styles are generally centralized to your top-most containers outside `grid-area: some-area-name;` container classes (which may also have an align or justify) and the rare `display: contents;` (if you count that as Grid CSS) or `display: subgrid;`. Responsive layouts in CSS Grid is just changing the templates in your central containers based on your breakpoints.
I've gotten about to the point that even for 1D layouts I'm about to "forbid" junior developers from using flexbox to avoid its seemingly inevitable decline (in so many large apps I've seen) to inline-style soup via (usually ad hoc) Tailwind-like DSLs, because CSS Grid is easy enough and clean enough to use everywhere.
Re: Show HN: Struggle with CSS Flexbox? This Playground Is for You
#113Earlier quoted context omitted.
Then you can use 1fr 10fr or any ratio you want.
the any ratio I want is the point of the exercise. i don't know how many or what size. i want the first column to be just wide enough, and the second column to fill the space. what you suggested does not do that, but thanks for playing
Now that you've explained the rest of your requirements, I can see that `fr` is not suitable for the purpose. In the meantime you've gotten a better answer for the updated requirements, in particular min-content and max-content.
Re: Show HN: Struggle with CSS Flexbox? This Playground Is for You
#114Earlier quoted context omitted.
the any ratio I want is the point of the exercise. i don't know how many or what size. i want the first column to be just wide enough, and the second column to fill the space. what you suggested does not do that, but thanks for playing
You're welcome. Now that you've explained the rest of your requirements, I can see that `fr` is not suitable for the purpose. In the meantime you've gotten a better answer for the updated requirements, in particular min-content and max-content.
Re: Show HN: Struggle with CSS Flexbox? This Playground Is for You
#115Re: Show HN: Struggle with CSS Flexbox? This Playground Is for You
#116Earlier quoted context omitted.
You're welcome. Now that you've explained the rest of your requirements, I can see that `fr` is not suitable for the purpose. In the meantime you've gotten a better answer for the updated requirements, in particular min-content and max-content.
The requirements have not changed.
First:
> I want a simple 2 column row with the first field being narrow and the second field stretching to fill the width
Second:
> i want the first column to be just wide enough, and the second column to fill the space.
Re: Show HN: Struggle with CSS Flexbox? This Playground Is for You
#117Re: Show HN: Struggle with CSS Flexbox? This Playground Is for You
#118As a heads-up to any other developer - this is the type of thing at which LLM's excel. I would absolutely never mess with Flexbox on my own anymore. It's too esoteric and weird, and I don't need to waste time trying to get things to line up when ChatGPT or any other LLM can get it done almost instantaneously.
I have never had any trouble with flexbox or grid, but am curious how do you use LLMs to do your layout or to get it to do layout with flexboxes? Do you just give it a very detailed description of the layout? Or do you give it an image that you have put together? Do you have an example of this? I am very curious to try it myself.
I treat it as if I'm speaking with the world's foremost expert on CSS and most of the time it's spot on.