Skip to content

Commit 3e05e4c

Browse files
committed
[css-position-3] Rewrite relpos section.
1 parent d726236 commit 3e05e4c

1 file changed

Lines changed: 34 additions & 85 deletions

File tree

css-position-3/Overview.bs

Lines changed: 34 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -497,54 +497,37 @@ Box Insets Shorthands: the 'inset-block', 'inset-inline', and 'inset' properties
497497
exactly as the 'margin' property does for its longhands.
498498

499499

500-
<h3 id="rel-pos">
501-
Relative positioning</h3>
500+
<h3 id="relpos">
501+
Relative Positioning</h3>
502502

503-
Once a box has been laid out according to the <a>normal flow</a> or <a>floated</a>,
504-
it may be offset relative to this position.
505503

506-
This is called [=relative positioning=]
507-
Offsetting a box (B1) in this way has no effect on the box (B2) that follows:
508-
B2 is given a position as if B1 were not offset
509-
and B2 is not re-positioned after B1’s offset is applied.
510-
This implies that relative positioning may cause boxes to overlap.
511-
However, if relative positioning causes an ''overflow: auto'' or ''overflow: scroll'' box to have overflow,
512-
the user agent must allow the user to access this content (at its offset position),
513-
which, through the creation of a scrolling mechanism, may affect layout.
504+
For a [=relatively positioned=] box,
505+
the [=inset properties=] move the box inward
506+
from the respective edge,
507+
without changing its size.
508+
'left' moves the box to the right, 'right' moves it to the left, etc.
509+
Since boxes are not split or stretched as a result of [=relative positioning=]
510+
opposing [=used values=] in a given axis must be negations of each other:
514511

515-
A relatively positioned box keeps its <a>normal flow</a> size,
516-
including line breaks and the space originally reserved for it.
512+
<ul>
513+
<li>
514+
If opposing [=inset properties=] in an axis both compute to 'auto'
515+
(their [=initial values=]),
516+
their [=used values=] are zero
517+
(i.e., the boxes stay in their original position in that axis).
518+
519+
<li>
520+
If only one is ''auto'',
521+
its [=used value=] becomes the negation of the other,
522+
and the box is shifted by the specified amount.
523+
524+
<li>
525+
If neither is ''auto'',
526+
the position is over-constrained;
527+
the [=computed value|computed=] [=end=] side value is ignored,
528+
and its [=used value=] becomes the negation of the [=start=] side.
529+
</ul>
517530

518-
A relatively positioned box establishes a new <a>containing block</a> for absolutely positioned descendants.
519-
(This is a common use of relatively positioned boxes.)
520-
The section on <a>containing blocks</a>
521-
explains when a relatively positioned box establishes a new <a>containing block</a>.
522-
523-
For relatively positioned elements,
524-
'left' and 'right' move the box(es) horizontally,
525-
without changing their size.
526-
'left' moves the boxes to the right, and 'right' moves them to the left.
527-
Since boxes are not split or stretched as a result of 'left' or 'right',
528-
the used values are always: left = -right.
529-
530-
If both 'left' and 'right' are ''left/auto'' (their initial values),
531-
the used values are ''0''
532-
(i.e., the boxes stay in their original position).
533-
534-
If 'left' is ''left/auto'',
535-
its used value is minus the value of 'right'
536-
(i.e., the boxes move to the left by the value of 'right').
537-
538-
If 'right' is specified as ''right/auto'',
539-
its used value is minus the value of 'left'.
540-
541-
If neither 'left' nor 'right' is ''left/auto'',
542-
the position is over-constrained,
543-
and one of them has to be ignored.
544-
If the 'direction' property of the <a>containing block</a> is ''ltr'',
545-
the value of 'left' wins and 'right' becomes -'left'.
546-
If 'direction' of the containing block is ''rtl'',
547-
'right' wins and 'left' is ignored.
548531

549532
<div class="example">
550533

@@ -557,48 +540,14 @@ Relative positioning</h3>
557540
</pre>
558541
</div>
559542

560-
The 'top' and 'bottom' properties move relatively positioned element(s) up or
561-
down without changing their size. 'Top' moves the boxes down, and 'bottom' moves
562-
them up. Since boxes are not split or stretched as a result of 'top' or 'bottom',
563-
the used values are always: top = -bottom.
564-
565-
If 'top' and 'bottom' are ''top/auto'',
566-
their used values are both ''0''.
567-
568-
If one of them, 'top' or 'bottom', is ''top/auto'',
569-
the ''top/auto'' value becomes the negative of the other.
570-
571-
If neither 'top' and 'bottom' is ''top/auto'',
572-
'bottom' is ignored
573-
(i.e., the used value of 'bottom' will be minus the value of 'top').
574-
575-
Note: Although relative positioning could be used as a form of superscripting and subscripting,
576-
the line height is not automatically adjusted to take the positioning into consideration.
577-
See the description of <a href="https://www.w3.org/TR/CSS2/visudet.html#line-height">line height calculations</a>
578-
for more information.
579-
580-
<h4 id='relpos-tables'>
581-
Effects of Relative Positioning On Table Elements</h4>
582-
583-
The effect of ''position: relative'' on table elements is defined as follows:
584-
585-
: table-row-group
586-
: table-header-group
587-
: table-footer-group
588-
: table-row
589-
:: offset relative to its normal position within the table.
590-
If table-cells span multiple rows,
591-
only the cells originating in the <a>relative positioned</a> row are offset.
592-
593-
: table-column-group
594-
: table-column
595-
:: do not offset the respective column
596-
and has no visual affect when ''position: relative'' is applied.
543+
If specified on
544+
a ''table-row-group'', ''table-header-group'', ''table-footer-group'', or ''table-row'' [=box=]
545+
the shift affects all the contents of the box,
546+
including all [=table cells=] that originate in the affected row,
547+
but not those that don't.
597548

598-
: table-caption
599-
: table-cell
600-
:: offset relative to its normal position within the table.
601-
If a table cell spans multiple columns or rows the full spanned cell is offset.
549+
Note: Since 'position' does not apply to ''table-column-group'' or ''table-column'' boxes,
550+
they are not affected by [=relative positioning=].
602551

603552
<!-- End section: Relative positioning -->
604553

0 commit comments

Comments
 (0)