3 ms·
Suppose you want to create the largest possible square div inside the rectangle of another div. Any layout language that can't let me satisfy such a simple and
by drcode 12y ago
Suppose you want to create the largest possible square div inside the rectangle of another div. Any layout language that can't let me satisfy such a simple and obvious layout constraint is a travesty.
CSS will not let you do this, even with flexbox.
- deleted 12y ago[deleted]
- Lerc 12y agoHas anyone assembled a list of things such as this that CSS cannot do? FlexBox always felt like it was a direct response to a few specific cases rather than a generalized gain in flexibility.
- DougWebb 12y agoI'm pretty sure FlexBox solves the "Why the hell can't I center these things vertically relative to one another?!?" problem that CSS has had for a very long time. Unfortunately, that wasn't the only problem CSS has had. Now we have to wait for CSS Grids, which look awesome and all, but based on history (floats, positioning, inline-blocks, flexbox) I'm not getting my hopes up that Grids will finally make CSS layouts reasonably adequate. (I'm not even raising the bar to 'usable'.)
- girvo 12y agoGSS will though! http://gridstylesheets.org/ http://gridstylesheets.org/
- timdorr 12y agoHuh? Flexbox will certainly let you do this: http://plnkr.co/edit/taXhuM4tetbNTlaKyjDr?p=preview http://plnkr.co/edit/taXhuM4tetbNTlaKyjDr?p=preview (you shouldn't see any of the red box, just the green box) Am I misinterpreting what you mean?
- ars 12y ago> Am I misinterpreting what you mean? Yes. The red one should be a rectangle and the green one a square. In your case the red one is also a square.
- scotty79 12y agoFlexbox also doesn't interoperate with grids very well. Also can't lay out elements that are not siblings.