Skip to content

[css-gaps] Gap decoration outsets at the edges #12024

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

Open
alisonmaher opened this issue Mar 28, 2025 · 5 comments
Open

[css-gaps] Gap decoration outsets at the edges #12024

alisonmaher opened this issue Mar 28, 2025 · 5 comments

Comments

@alisonmaher
Copy link
Collaborator

In the CSS Gap Decoration spec, percentage-based gap outsets are resolved to 0 at the edges.

This makes sense to me, although I'm wondering for other kinds of outset values, if an author still might want to have the outset at the edge different than all other intersection points. The main case I could see is whether an author wants this to match other outsets, or always compute to zero at the edges.

Given this, perhaps we could add an optional input to the *-outset properties that indicates whether the outset is applied to the edges.

Something like rule-outset: 5px exclude-edges, where the default is include-edges (or perhaps exclude-edges would make sense as the default). And exclude-edges would mean that the outset is treated as 0 at the edges, instead of what is specified by the author.

CC @kbabbitt

@kbabbitt
Copy link
Collaborator

kbabbitt commented Apr 21, 2025

Finer control over outsets also showed up in Explainer feedback: MicrosoftEdge/MSEdgeExplainers#996

@kbabbitt
Copy link
Collaborator

kbabbitt commented May 2, 2025

So I suppose the way I was thinking about it is:

  1. we need some way of defining the location where a gap decoration ends at the edge of the container;
  2. it would be nice if these container-edge endpoints could be defined so that they work similar to interior endpoints where gaps intersect;
  3. that could be achieved by treating the container edges as if they were "zero width gaps" so to speak

The "percentages resolving to 0 at the edges" behavior fell out of point 3. Perhaps it would make things clearer to define those zero-width gaps explicitly? That would also give us a tool to address #12084.

Also, on the use case for exclude-edges vs include-edges: Were you thinking of something similar to what's in explainer issue 996 linked above? Or did you have something else in mind?

@alisonmaher
Copy link
Collaborator Author

I suppose the use case I was thinking of could handled by issue 996.

The main case I was thinking of was if you want to adjust outsets everywhere but at the edges, such that the decorations are always flush with the edge, but take the outset into account at all other intersections.

I'm not sure if there is an author need for this, but it came to mind when reviewing some of the wpt tests for the feature where the decoration overflowed the edges as a result of the outset, and I figured that is unlikely to be a desirable behavior. See https://chromium-review.googlesource.com/c/chromium/src/+/6341671/19/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/grid/grid-gap-decorations-012.html as an example

@kbabbitt
Copy link
Collaborator

kbabbitt commented May 2, 2025

I'm not sure if there is an author need for this, but it came to mind when reviewing some of the wpt tests for the feature where the decoration overflowed the edges as a result of the outset, and I figured that is unlikely to be a desirable behavior. See https://chromium-review.googlesource.com/c/chromium/src/+/6341671/19/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/grid/grid-gap-decorations-012.html as an example

One use case I had in mind for decorations extending outside the bounds of the container is something like #2748 (comment):
Image

I envisioned constructing this by doing something like:

.container {
  display: grid;
  grid-template-columns: 400px 100px;
  row-gap: 10px;
  row-rule: 1px solid silver;
  row-rule-outset: 10px;
  margin: 10px;
}

such that the decorations extend into margins on the grid. Though if that would be considered weird, I suppose authors could achieve the same effect with padding on the grid items instead.

@alisonmaher
Copy link
Collaborator Author

alisonmaher commented May 3, 2025

Thanks for the example, that does feel like a plausible authoring use case, and I think this is a valid use case to support. (This case would be covered by include-edges).

When there is more than one colum, though, like in https://chromium-review.googlesource.com/c/chromium/src/+/6341671/19/third_party/blink/web_tests/external/wpt/css/css-gaps/tentative/grid/grid-gap-decorations-012.html, I'm wondering if there are cases where an author would want to apply a larger outset everywhere but the edges. Maybe not, but if so, I don't think there is a way to achieve that currently (unless an author were to use percentages).

Perhaps the suggestion in 996 could help with that, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants