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

Re: [csswg-drafts] [css-align][css-grid] Baseline self-alignment may affect the intrinsic size contribution of the alignment subject.

From: Javier Fernandez Garcia-Boente via GitHub <sysbot+gh@w3.org>
Date: Tue, 09 May 2017 09:05:14 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-300105360-1494320713-sysbot+gh@w3.org>
Let's take your example to introduce the doubts I have regarding the issue of baseline affecting the intrinsic size.

> First we size all the items in the row normally.
As the items are relatively sized, we need to assume their container height is auto, so for the matter of track sizing alg, row will be sized as if items were auto sized. As per Tab issue #1319, we will resolved the item's size based on the "definite" final size of the row track.

> Then we align them together. 
If I understood correctly, you are suggesting that we run the baseline alignment algorithm **before** the tracks sizing algorithm. This could work for non-empty grid items, but it will have some implications for empty or items that need to synthesize their baselines (replaced or orthogonal to the baseline axis). In case of synthesized baseline we will need to know the actual item's height to compute the baseline alignment offsets. 

> Then we size the rows: in the first step we consider only nonspanning items, so we size the first row accordingly. This will include the alignment “margin/padding" that we calculated for these items. Then we adjust the rows to accommodate the spanning items if necessary.
I admit that I might add some noise mentioning content alignment here, but it matters as well because the content-distribution gaps will be based on the available space **after** running the tracks sizing algorithm; depending on **when** the baseline alignment logic happens it may have some impact on the final available size. Hence, since items spanning more that one rows have grid areas which size depends on such content-distribution offsets, the order of the different alignment procedures matters. this may also have some impact when we resolve the percentage sizes later.

But let's leaving aside for a moment the content-distribution issues. What it really worries me is how the baseline alignment offset affects the intrinsic size of the grid areas. Since that's what the spec states, we would need to run the baseline alignment **before**  the track sizing. But as synthesized baselines depend on the resolved heights of the item we should run it **after** determining the grid item's area.  

Let's use this simplified example to illustrate the issue:
`.grid {
  display: grid;
  font: 20px/1 Ahem;
  grid-auto-columns: 100px;
  align-items: baseline;
.i1 {
  background: magenta;
  height: 50%;
.i2 {
  background: cyan;
  grid-column: 2;
  font-size: 40px;
.i3 {
  background: yellow;
<div class="grid" style="height: 100px;">
  <div class="i1"></div>
  <div class="i2">X</div>
  <div class="i3">p</div>

GitHub Notification of comment by javifernandez
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1039#issuecomment-300105360 using your GitHub account
Received on Tuesday, 9 May 2017 09:05:24 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:12 UTC