Skip to content

Commit cf6a6ad

Browse files
committed
Add layout-grid-mode: baseline
1 parent e787674 commit cf6a6ad

2 files changed

Lines changed: 58 additions & 12 deletions

File tree

css-line-grid/Overview.html

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ <h3 id=layout-grid-mode-prop><span class=secno>3.1. </span>Grid Mode: the
418418
<tr>
419419
<th>Value:
420420

421-
<td>none | block | line
421+
<td>none | baseline | block | line
422422

423423
<tr>
424424
<th>Initial:
@@ -460,6 +460,17 @@ <h3 id=layout-grid-mode-prop><span class=secno>3.1. </span>Grid Mode: the
460460

461461
<dd>Do not align any objects to the grids.
462462

463+
<dt><dfn id=baseline title="layout-grid-mode::baseline">&lsquo;<code
464+
class=css>baseline</code>&rsquo;</dfn>
465+
466+
<dd>Align baselines to the line grids. <!--
467+
The line in this definition is a line box
468+
with before margin included if it is the first line of a block,
469+
and with after margin if last.
470+
-->
471+
The height is the height of the line box. Increasing heights to fit to
472+
grids is done by increasing the computed height of the line box.
473+
463474
<dt><dfn id=block title="layout-grid-mode::block">&lsquo;<code
464475
class=css>block</code>&rsquo;</dfn>
465476

@@ -484,12 +495,22 @@ <h3 id=layout-grid-mode-prop><span class=secno>3.1. </span>Grid Mode: the
484495
<p class=issue>Handling margins and borders needs review
485496

486497
<p>When this property is set to anything other than &lsquo;<code
487-
class=css>none</code>&rsquo;, the object to align is vertically centered
488-
within the grid row. If the computed height is larger than the grid space,
489-
then the object is centered within the smallest number of grid rows
490-
necessary for the object to fit in. The starting alignment point is moved
491-
accordingly. This is illustrated below, where <em>a</em> represents the
492-
numerical &lsquo;<a href="#layout-grid-line"><code
498+
class=css>none</code>&rsquo;, the computed height of the object is
499+
increased to the smallest multiple of the grid heights that is equal to or
500+
smaller than the original computed height.
501+
502+
<p>When the value of this property is &lsquo;<code
503+
class=css>baseline</code>&rsquo;, the line box is then moved so that its
504+
baseline is aligned to the next closest grid.
505+
506+
<p>When the value of this property is either &lsquo;<code
507+
class=css>block</code>&rsquo; or &lsquo;<code
508+
class=css>line</code>&rsquo;, the object is vertically centered within the
509+
grid row. If the computed height is larger than the grid space, then the
510+
object is centered within the smallest number of grid rows necessary for
511+
the object to fit in. The starting alignment point is moved accordingly.
512+
This is illustrated below, where <em>a</em> represents the numerical
513+
&lsquo;<a href="#layout-grid-line"><code
493514
class=property>layout-grid-line</code></a>&rsquo; value, <em>b</em> and
494515
<em>c</em> are half the difference between the computed line-heights and
495516
either the layout-grid-line value or twice the value respectively.:
@@ -518,7 +539,8 @@ <h3 id=layout-grid-mode-prop><span class=secno>3.1. </span>Grid Mode: the
518539
baselines to grids rather than center of line boxes if we consider cases
519540
like only a word in a line is large. But how can we align baselines to
520541
grids? Align baselines to center of grids? Lines may not fit within one
521-
grid.
542+
grid. Align baselines to grids might work better, but it may not work well
543+
with settings headigns to &lsquo;<code class=css>block</code>&rsquo;.
522544

523545
<div class=example>
524546
<div class=sidefigure> <img alt="Large text wraps within line grids"
@@ -866,6 +888,9 @@ <h2 class=no-num id=index>Index</h2>
866888
<li>layout-grid-mode, <a href="#layout-grid-mode"
867889
title=layout-grid-mode><strong>3.1.</strong></a>
868890
<ul>
891+
<li>baseline, <a href="#baseline" title="layout-grid-mode,
892+
baseline"><strong>3.1.</strong></a>
893+
869894
<li>block, <a href="#block" title="layout-grid-mode,
870895
block"><strong>3.1.</strong></a>
871896

@@ -935,7 +960,7 @@ <h2 class=no-num id=property-index>Property index</h2>
935960
<tr valign=baseline>
936961
<td><a class=property href="#layout-grid-mode">layout-grid-mode</a>
937962

938-
<td>none | block | line
963+
<td>none | baseline | block | line
939964

940965
<td>none
941966

css-line-grid/Overview.src.html

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ <h3 id="layout-grid-mode-prop">Grid Mode: the 'layout-grid-mode' property</h3>
262262
<td><dfn>layout-grid-mode</dfn>
263263
<tr>
264264
<th>Value:
265-
<td>none | block | line
265+
<td>none | baseline | block | line
266266
<tr>
267267
<th>Initial:
268268
<td>none
@@ -289,6 +289,17 @@ <h3 id="layout-grid-mode-prop">Grid Mode: the 'layout-grid-mode' property</h3>
289289
<dl>
290290
<dt><dfn title="layout-grid-mode::none">''none''</dfn></dt>
291291
<dd>Do not align any objects to the grids.</dd>
292+
<dt><dfn title="layout-grid-mode::baseline">''baseline''</dfn></dt>
293+
<dd>Align baselines to the line grids.
294+
<!--
295+
The line in this definition is a line box
296+
with before margin included if it is the first line of a block,
297+
and with after margin if last.
298+
-->
299+
The height is the height of the line box.
300+
Increasing heights to fit to grids is done by
301+
increasing the computed height of the line box.
302+
</dd>
292303
<dt><dfn title="layout-grid-mode::block">''block''</dfn></dt>
293304
<dd>Align blocks to the line grids.
294305
<!--
@@ -313,7 +324,16 @@ <h3 id="layout-grid-mode-prop">Grid Mode: the 'layout-grid-mode' property</h3>
313324
<p class="issue">Handling margins and borders needs review</p>
314325

315326
<p>When this property is set to anything other than ''none'',
316-
the object to align is vertically centered within the grid row.
327+
the computed height of the object is increased to
328+
the smallest multiple of the grid heights
329+
that is equal to or smaller than the original computed height.</p>
330+
331+
<p>When the value of this property is ''baseline'',
332+
the line box is then moved so that its baseline is aligned
333+
to the next closest grid.</p>
334+
335+
<p>When the value of this property is either ''block'' or ''line'',
336+
the object is vertically centered within the grid row.
317337
If the computed height is larger than the grid space,
318338
then the object is centered within the smallest number of grid rows
319339
necessary for the object to fit in.
@@ -349,7 +369,8 @@ <h3 id="layout-grid-mode-prop">Grid Mode: the 'layout-grid-mode' property</h3>
349369
to align baselines to grids rather than center of line boxes
350370
if we consider cases like only a word in a line is large.
351371
But how can we align baselines to grids?
352-
Align baselines to center of grids? Lines may not fit within one grid.</p>
372+
Align baselines to center of grids? Lines may not fit within one grid.
373+
Align baselines to grids might work better, but it may not work well with settings headigns to ''block''.</p>
353374

354375
<div class="example">
355376
<div class="sidefigure">

0 commit comments

Comments
 (0)