W3C home > Mailing lists > Public > public-css-archive@w3.org > May 2017

Re: [csswg-drafts] [css-align][css-multicol] 'justify-content' other than 'normal' or 'stretch' should change column count/size rules

From: Florian Rivoal via GitHub <sysbot+gh@w3.org>
Date: Thu, 25 May 2017 08:49:54 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-303958104-1495702193-sysbot+gh@w3.org>
> for some reason it conditions it to only be when column-count is also non-auto. I don't see why that condition should be there.

I don't see it either.

Additionally, it feels like we need to say a bit more about how do the column-gaps interact with the distributed space.
For instance, if you have
```css
article {
  columns: 3 100px;
  column-gap: 10px;
  width: 340px;
  justify-content: space-evenly;
}
```
which of the following two behaviors does it mean:
1. `(340 - 100 * 3) / 4 = 10px`  between and around each column
2. `(340 - 100 * 3 - 10 * 2 ) / 4 = 5px` before the first column and after the last column and `5+10=15px` between the columns?

Behavior 2 is probably the one the spec currently intends (since it does not give enough details to define anything else), but would mean that the author needs to set the column-gap to 0 to get space-evenly and space-around to have their intended effect. In addition to being probably unexpected by authors, this does not have good fallback behavior in browsers that do no support justify-content on multi-col. Also, even in browsers that do support justify-content, if the width of the multicol is "just right", you may end up with no space between the columns at all, which seems pretty bad too.

So I think Behavior 1 would be nicer, but it requires that we give a new meaning to column-gap in these situations. The logical answer would be that becomes a minimum spacing. For `space-between`, that would be the minimum space between the columns. For `left`, `right`, `start`, `end`, and presumably `center`, that would be the exact space between the columns. For `space-evenly` it would be the minimum size of the even spaces. for `space-around` it could be the minimum space between the columns, with a minimum of half that space before the first one and after the last one.

In that case, with the space-around and space-evenly values, unless we want to allow columns with a used width smaller than the specified width, we also need to change the formula to get the number of columns. For instance:
```css
article {
  columns: 3 100px;
  column-gap: 10px;
  width: 320px;
  justify-content: space-evenly;
}
```
has 3 columns if you ignore `justify-content` or apply behavior 2, but it needs to have 2 columns if you apply behavior 1:
3*100 + 4*10 > 320, so we cannot have 3 columns. Instead we can have 2, with 4 `30px` spaces around them.

This would mean changing the algo to determine the number of columns. Specifically, this part:
`floor((U + column-gap)/(column-width + column-gap)))`
would stay as if if justify-content is any value other than `space-around` or `space-evenly`, but would be changed to `floor((U + 2* column-gap)/(column-width + column-gap)))` for `space-evenly` and to `floor((U + 1.5* column-gap)/(column-width + column-gap)))` for `space-around`.

-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1420#issuecomment-303958104 using your GitHub account
Received on Thursday, 25 May 2017 08:50:01 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 10:12:54 UTC