-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-sizing] Stretch-fitting inline size next to floats. #4028
Comments
Interestingly enough, the answer varies: for boxes that establish an independent containing block, CSS2 says they fit in the remaining space after the float; for non-replaced blocks, the float is ignored. Probably |
There is a 17-star issue in Chrome that relies on the CSSWG to resolve the specification as soon as possible. |
@dholbert Based on your description here[1], you're leaning towards |
That's my leaning, yeah, based simply on what the spec currently says about
https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing I don't have especially strong feelings on this at the moment, though; if there are reasons to favor the other behavior, that's probably fine too. |
So I have (very) strong feelings 😀 that it should go beside the float. Basically the nice thing about the new In Blink, we never resolve an E.g. In For block layout the rules are a little more complex but basically: replaced, tables, floats, and some form controls are For new formatting contexts with "auto-as-stretch", all engines today consider the available space for this calculation as adjusted for floats. Basically I'd like to keep the invariant that engines can coerce If we don't go down this path to fully "explain" From the web-developer perspective if we go with the "next-to-float" definition:
If we go with the "clears-floats" definition:
The "next-to-float" definition is strictly more powerful for developers. @dholbert - Does this make sense? |
Re-reading Elika's initial response, I think my long-winded response is saying the same thing :P . |
@bfgeek yup, that makes sense to me - thanks for the explanation! I like the idea of explaining |
FWIW when we realized this, we did a refactor, and it simplified our (maybe I'll write a blog post about this one day). |
Good to know. I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1920816 to look into a similar refactoring on our side. |
However, |
@bfgeek Currently in Chrome, data:text/html;charset=UTF-8,<!doctype html>
<div style="float:left; width:100px; height:100px; border:1px solid;">float: left</div>
<input type="text" style="overflow:hidden !important;
width:-webkit-fill-available; width: -moz-available; border: 2px solid blue;"> |
@yisibl - So this is because by default
|
One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1370209}
One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1370209}
One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1370209}
…idth/height, a=testonly Automatic update from web-platform-tests [layout] Accept 'stretch' keyword as a width/height One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1370209} -- wpt-commits: 9356370c840aabd208b5460fb11efaab8b4f94e6 wpt-pr: 48680
…idth/height, a=testonly Automatic update from web-platform-tests [layout] Accept 'stretch' keyword as a width/height One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaronchromium.org> Commit-Queue: David Grogan <dgroganchromium.org> Cr-Commit-Position: refs/heads/main{#1370209} -- wpt-commits: 9356370c840aabd208b5460fb11efaab8b4f94e6 wpt-pr: 48680 UltraBlame original commit: 22a10cdf4ad6356ec9dfd4fc78e2c3c71770eca7
…idth/height, a=testonly Automatic update from web-platform-tests [layout] Accept 'stretch' keyword as a width/height One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaronchromium.org> Commit-Queue: David Grogan <dgroganchromium.org> Cr-Commit-Position: refs/heads/main{#1370209} -- wpt-commits: 9356370c840aabd208b5460fb11efaab8b4f94e6 wpt-pr: 48680 UltraBlame original commit: 22a10cdf4ad6356ec9dfd4fc78e2c3c71770eca7
…idth/height, a=testonly Automatic update from web-platform-tests [layout] Accept 'stretch' keyword as a width/height One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaronchromium.org> Commit-Queue: David Grogan <dgroganchromium.org> Cr-Commit-Position: refs/heads/main{#1370209} -- wpt-commits: 9356370c840aabd208b5460fb11efaab8b4f94e6 wpt-pr: 48680 UltraBlame original commit: 22a10cdf4ad6356ec9dfd4fc78e2c3c71770eca7
…idth/height, a=testonly Automatic update from web-platform-tests [layout] Accept 'stretch' keyword as a width/height One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1370209} -- wpt-commits: 9356370c840aabd208b5460fb11efaab8b4f94e6 wpt-pr: 48680
…idth/height, a=testonly Automatic update from web-platform-tests [layout] Accept 'stretch' keyword as a width/height One of our goals is for `-webkit-fill-available` and `stretch` to have identical layout behavior. Feature is not yet ready to ship. Remaining work: * support stretch in flex-basis * add abspos tests with one inset specified * add aspect ratio test and fix if necessary * ditto with fixed table layout as mentioned in w3c/csswg-drafts#4028 (comment) * serialization? * Test that auto margins are treated as 0 * fix block-height-2.html behavior and/or decide to change the spec * Add margin tests and fix our behavior for the cases discussed in w3c/csswg-drafts#11044 Change-Id: I8c773eb3fe964e58877e0d7d8dbb6325580e0cda Bug: 41253915 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5884393 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1370209} -- wpt-commits: 9356370c840aabd208b5460fb11efaab8b4f94e6 wpt-pr: 48680
https://drafts.csswg.org/css-sizing-4/#stretch-fit-sizing
https://drafts.csswg.org/css-sizing-3/#auto-box-sizes
The spec currently doesn't provide a size keyword to achieve this effect, but there used to be one named "fill-available", then renamed to "fill", "stretch" and/or "stretch-fit".
The behavior is partially defined, though, in level 3.
"The size a box would take if its outer size filled the available space in the given axis; in other words, the stretch fit into the available space, if that is definite."
Furthermore, the spec already refers to stretch-fit sizing as part of resolving fit-content, so my question is: How is stretch-fitting in the inline dimension affected by adjacent floats?
Should the yellow box fit to the right of the yellow box, or go below, and use the entire width of its containing block?
The text was updated successfully, but these errors were encountered: