Skip to content
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-grid] Gap background splitting #2117

Closed
seejamescode opened this issue Dec 18, 2017 · 4 comments
Closed

[css-grid] Gap background splitting #2117

seejamescode opened this issue Dec 18, 2017 · 4 comments

Comments

@seejamescode
Copy link

Related to: https://www.w3.org/TR/css-grid-1/#gutters

From all CSS Grid Layout onboarding resources I have experienced, the gap properties have been described as the rules to handle your grid gutter with. I think it is helpful when the grid follows a single background color (Ex 1) or every item includes extra padding (Ex 2).

However, many visual designers use background color to identify separations in a grid (Ex 3). This is a common use-case that I hope CSS Grid Layout can support:
screen shot 2017-12-17 at 10 46 50 pm

The current way to achieve this use-case is to use no gap rules and instead apply a padding class to all items on the grid.

Proposed Solution:

Introducing a new property and rule for the grid parent called gap-background: split; that would let the background values of adjacent items expand to meet halfway at the gutter. I am proposing this solution because I believe it would give CSS Grid Layout the capabilities that print-based designers would assume it had.

@myakura myakura added the css-grid-2 Subgrid; Current Work label Dec 18, 2017
@Nadya678
Copy link

I think the "ignore-gap" for concrete "cells" will be better solution. The grid cell will be enlarged 0.5 size of gap in all direction if ignore-gap is enabled.

@seejamescode
Copy link
Author

@Nadya678 It sounds like that will help when there is single items on the grid that need to ignore gap. In the situation I describe above though, that would mean I still need to apply padding to all grid items. Correct?

@SelenIT
Copy link
Collaborator

SelenIT commented Dec 27, 2017

In the given example, I see the gap between the columns twice as wide as gaps between the edges and the columns. This is not how gap works. I'd say that these free space areas are not gutters at all, but the extra grid tracks used for negative space (like in this well-known example of the full bleed grid layout) or. at least, the middle gutter is actually two gutters around a virtual zero-width column, and we can attach the grid items to this virtual column lines (like in this JSfiddle example). We can even use separate (pseudo-)elements for this, attaching the content and the decorations to different grid lines (as shown in the last row of the example), to avoid need to recalculate paddings for grid items.

So I don't see the need to introduce extra complication like suggested here. I'm for keeping the gutter concept as simple as it is, and using existing grid features for creating areas with background.

@tabatkins
Copy link
Member

This doesn't seem very compatible with the CSS box model; for example, where's the border in this example? The fact that it can be fairly simply achieved with 'padding' suggests that it doesn't need to be specially solved for Grid here, which would introduce extra complexity to the Grid model, both for authors and for implementors.

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

5 participants