Skip to content

Commit 440c099

Browse files
committed
[css-position-3] Rewrite box offsets section.
1 parent 10269a4 commit 440c099

1 file changed

Lines changed: 75 additions & 249 deletions

File tree

css-position-3/Overview.bs

Lines changed: 75 additions & 249 deletions
Original file line numberDiff line numberDiff line change
@@ -747,288 +747,114 @@ Fixed positioning</h3>
747747

748748
<!-- End section: Choosing a positioning scheme: 'position' property -->
749749

750-
<h2 id="box-offsets-trbl">
751-
Box offsets: 'top', 'right', 'bottom', 'left'</h2>
750+
<h2 id="coords">
751+
Positioning Coordinates</h2>
752752

753-
An element is said to be <a>positioned</a>
754-
if its 'position' property has a value other than ''static''.
755-
Positioned elements generate positioned boxes,
756-
and may be laid out according
757-
to the following four physical properties:
753+
The precise location of a [=positioned box=] is controlled by
754+
the <dfn>inset properties</dfn>:
755+
the [=physical=] [=inset properties=] 'top', 'right', 'bottom', 'left';
756+
the [=flow-relative=] [=inset properties=] 'inset-block-start', 'inset-inline-start', 'inset-block-end', and 'inset-inline-end';
757+
and their [=shorthands=], 'inset-block', 'inset-inline', and 'inset'.
758758

759-
<pre class="propdef">
760-
Name: top
761-
Value: auto | <<length-percentage>>
762-
Initial: auto
763-
Applies to: positioned elements
764-
Inherited: no
765-
Animation type: length or percentage
766-
Percentages: refer to height of <a>containing block</a>
767-
Computed value: the keyword ''top/auto'' or a computed <<length-percentage>> value
768-
Animation type: by computed value type
769-
</pre>
770-
771-
This property specifies how far an absolutely positioned box’s top margin edge
772-
is offset below the top edge of the box’s <a>containing block</a>.
773-
774-
For relatively positioned boxes,
775-
the offset is with respect to the top edge of the box itself
776-
(i.e., the box is given a position in the <a>normal flow</a>,
777-
and then offset from that position according to this property).
778-
779-
For sticky positioned boxes,
780-
the value is used to compute the <a>sticky-constraint rectangle</a>
781-
as described in Sticky positioning.
782-
783-
For absolutely positioned elements
784-
whose <a>containing block</a> is established by a block-level element,
785-
this property is an offset from the padding edge of that element.
786-
787-
<pre class="propdef">
788-
Name: right
789-
Value: auto | <<length-percentage>>
790-
Initial: auto
791-
Applies to: positioned elements
792-
Inherited: no
793-
Animation type: length or percentage
794-
Percentages: refer to height of <a>containing block</a>
795-
Computed value: the keyword ''right/auto'' or a computed <<length-percentage>> value
796-
Animation type: by computed value type
797-
</pre>
798-
799-
Similar to 'top', but specifies how far a box’s right margin edge is offset
800-
to the left of the right edge of the box’s <a>containing block</a>.
801-
802-
For relatively positioned boxes,
803-
the offset is with respect to the right edge of the box itself
804-
(i.e., the box is given a position in the <a>normal flow</a>,
805-
and then offset from that position according to this property).
806-
807-
For sticky positioned boxes,
808-
the value is used to compute the <a>sticky-constraint rectangle</a>
809-
as described in Sticky positioning.
810-
811-
For absolutely positioned elements
812-
whose <a>containing block</a> is based on a block-level element,
813-
this property is an offset from the padding edge of that element.
814-
815-
<pre class="propdef">
816-
Name: bottom
817-
Value: auto | <<length-percentage>>
818-
Initial: auto
819-
Applies to: positioned elements
820-
Inherited: no
821-
Animation type: length or percentage
822-
Percentages: refer to height of <a>containing block</a>
823-
Computed value: the keyword ''bottom/auto'' or a computed <<length-percentage>> value
824-
Animation type: by computed value type
825-
</pre>
759+
The interpretation of these specified coordinates varies by [=positioning scheme=]:
826760

827-
Similar to 'top', but specifies how far a box’s bottom margin edge is offset
828-
above the bottom edge of the box’s <a>containing block</a>.
761+
* for [=absolute positioning=], the [=inset properties=] represent
762+
insets from the containing block.
763+
* for [=relative positioning=], the [=inset properties=] represent
764+
insets from the box’s original margin edge.
765+
* for [=sticky positioning=], the [=inset properties=] represent
766+
insets from the [=scrollport=] edge.
829767

830-
For relatively positioned boxes,
831-
the offset is with respect to the bottom edge of the box itself
832-
(i.e., the box is given a position in the <a>normal flow</a>,
833-
and then offset from that position according to this property).
834-
835-
For sticky positioned boxes,
836-
the value is used to compute the <a>sticky-constraint rectangle</a>
837-
as described in Sticky positioning.
838-
839-
For absolutely positioned elements
840-
whose <a>containing block</a> is based on a block-level element,
841-
this property is an offset from the padding edge of that element.
768+
<h3 id="insets">
769+
Box Insets: the 'top', 'right', 'bottom', 'left', 'inset-block-start', 'inset-inline-start', 'inset-block-end', and 'inset-inline-end' properties </h3>
842770

843771
<pre class="propdef">
844-
Name: left
772+
Name: top, right, bottom, left, inset-block-start, inset-inline-start, inset-block-end, inset-inline-end
845773
Value: auto | <<length-percentage>>
846774
Initial: auto
847775
Applies to: positioned elements
848776
Inherited: no
849-
Animation type: length or percentage
850-
Percentages: refer to height of <a>containing block</a>
851-
Computed value: the keyword ''left/auto'' or a computed <<length-percentage>> value
777+
Percentages: refer to size of <a>containing block</a>; see prose
778+
Computed value: the keyword ''top/auto'' or a computed <<length-percentage>> value
852779
Animation type: by computed value type
853780
</pre>
854781

855-
Similar to 'top', but specifies how far a box’s left margin edge is offset
856-
to the right of the left edge of the box’s <a>containing block</a>.
857-
858-
For relatively positioned boxes,
859-
the offset is with respect to the left edge of the box itself
860-
(i.e., the box is given a position in the <a>normal flow</a>,
861-
and then offset from that position according to this property).
862-
863-
For sticky positioned boxes,
864-
the value is used to compute the <a>sticky-constraint rectangle</a>
865-
as described in Sticky positioning.
866-
867-
For absolutely positioned elements
868-
whose <a>containing block</a> is based on a block-level element,
869-
this property is an offset from the padding edge of that element.
870-
871-
The values for the four properties have the following meanings:
782+
These [=inset properties=] represent an inward “inset”
783+
on the corresponding side of the box
784+
(with respect to the box’s own [=writing mode=];
785+
see [[!CSS-WRITING-MODES-3#abstract-box]]).
786+
For example, 'top' represents a downward inset of the top edge.
787+
The [=physical=] and [=flow-relative=] properties
788+
interact as defined in [[!CSS-LOGICAL-1]].
789+
Values have the following meanings:
872790

873-
<dl dfn-for="top,right,bottom,left, offset-start, offset-end, offset-before, offset-after" dfn-type="value">
791+
<dl dfn-for="top,right,bottom,left, inset-block-start,inset-inline-start,inset-block-end,inset-inline-end inset-block,inset-inline,inset" dfn-type="value">
874792
<dt><dfn>&lt;length></dfn>
875793
<dd>
876-
The offset is a fixed distance from the reference edge.
794+
The inset is a fixed distance from the reference edge.
877795
Negative values are allowed.
878796

879797
<dt><dfn>&lt;percentage></dfn>
880798
<dd>
881-
The offset is a percentage of the <a>containing block’s</a>
882-
width (for 'left' or 'right') or height (for 'top' and 'bottom').
883-
For sticky positioned elements,
884-
the offset is a percentage of the flow root's
885-
width (for 'left' or 'right') or height (for 'top' or 'bottom').
799+
The inset is a percentage
800+
relative to the <a>containing block</a>’s size
801+
in the corresponding axis
802+
(e.g. width for 'left' or 'right', height for 'top' and 'bottom').
803+
For [=sticky positioned=] boxes,
804+
the inset is instead
805+
relative to the relevant [=scrollport=]’s size.
886806
Negative values are allowed.
887807

888808
<dt><dfn>auto</dfn></dt>
889809
<dd>
890-
For non-replaced elements,
891-
the effect of this value depends on which of related properties
892-
have the value ''top/auto'' as well.
893-
See the sections on the 'width' and 'height' of absolutely positioned, non-replaced elements for details.
894-
For replaced elements,
895-
the effect of this value depends only on the intrinsic dimensions of the replaced content.
896-
See the sections on the 'width' and 'height' of absolutely positioned, replaced elements for details.
810+
Represents an unconstrained inset;
811+
the exact meaning depends on the [=positioning scheme=].
897812
</dl>
898813

899-
<p class="note">
900-
Note, for fixed positioned elements,
901-
using large values or negative values can easily move elements outside the <a>viewport</a>
902-
and make the contents unreachable through scrolling or other means.
903-
Authors should be aware that fixed position elements
904-
are always relative to the <span>initial containing block</span>.
905-
</p>
906-
<!-- End section: Box offsets: 'top', 'right', 'bottom', 'left' -->
907-
908-
<h3 id="logical-box-offsets-beaso">
909-
Logical Box Insets: 'inset-before', 'inset-end', 'inset-after' and 'inset-start'</h3>
910-
911-
Issue: See [[!CSS-LOGICAL-1]]; this section is not up-to-date.
912-
913-
Logical offset properties allow for insetting positioned boxes
914-
based on the 'writing-mode' and 'direction' properties.
915-
When both the physical property
916-
and equivalent logical property (based on 'writing-mode' and 'direction')
917-
are specified
918-
the physical property computes to the computed value of the corresponding logical property.
814+
Note: For [=fixed positioned=] elements,
815+
using large values or negative values
816+
can easily move elements outside the <a>viewport</a>
817+
and make the contents unreachable through scrolling or other means.
919818

920-
Positioned elements generate positioned boxes,
921-
and may be laid out according to the following four logical properties
922-
taking into account the 'writing-mode' and 'direction' of the <a>containing block</a>:
819+
<h3 id="inset-shorthands">
820+
Box Insets Shorthands: the 'inset-block', 'inset-inline', and 'inset' properties</h3>
923821

924822
<pre class="propdef">
925-
Name: inset-before, inset-after, inset-start, inset-end
926-
Value: auto | <<length-percentage>>
927-
Initial: auto
928-
Applies to: positioned elements
929-
Inherited: no
930-
Animation type: length or percentage
931-
Percentages: refer to height of <a>containing block</a>
932-
Computed value: the keyword ''inset-before/auto'' or a computed <<length-percentage>> value
933-
Animation type: by computed value type
823+
Name: inset-block, inset-inline
824+
Value: <'top'>{1,2}
825+
Initial: auto
826+
Applies to: positioned elements
827+
Inherited: no
828+
Percentages: see individual properties
829+
Computed value: see individual properties
830+
Animation type: by computed value type
934831
</pre>
935832

936-
For an absolutely positioned box
937-
this property specifies how far the corresponding margin edge is offset
938-
from the corresponding physical reference edge of the box’s <a>containing block</a>.
939-
940-
The particular physical reference edge that is used when offsetting
941-
is based on the 'writing-mode' and 'direction' properties.
942-
943-
The combination of the 'writing-mode' and 'direction' properties
944-
determines the appropriate physical reference edge for offsetting.
833+
The 'inset-block' and 'inset-inline' properties are [=shorthand properties=]
834+
for setting 'inset-block-start' + 'inset-block-end'
835+
or 'inset-inline-start' + 'inset-inline-end',
836+
respectively,
837+
in a single declaration.
838+
The first component value sets the start side,
839+
the second sets the end;
840+
if omitted, the second value defaults to the first.
945841

946-
The table below shows logical offset properties
947-
(per 'writing-mode' and 'direction')
948-
and the physical reference edge from which the offset will occur.
949-
950-
<figure>
951-
<table id="logical-physical-relations" class="lpr">
952-
<thead>
953-
<tr>
954-
<th colspan="2" rowspan="2"></th>
955-
<td colspan="6">'writing-mode' / 'direction'
956-
</tr>
957-
<tr>
958-
<td>horizontal-tb / ltr
959-
<td>horizontal-tb / rtl
960-
<td>vertical-rl / ltr
961-
<td>vertical-rl / rtl
962-
<td>vertical-lr / ltr
963-
<td>vertical-lr / rtl
964-
</tr>
965-
</thead>
966-
<tbody>
967-
<tr>
968-
<td rowspan="4"><div>Edge</div>
969-
<td>top
970-
<td>inset-before
971-
<td>inset-before
972-
<td>inset-start
973-
<td>inset-end
974-
<td>inset-start
975-
<td>inset-end
976-
</tr>
977-
<tr>
978-
<td>right
979-
<td>inset-end
980-
<td>inset-start
981-
<td>inset-before
982-
<td>inset-before
983-
<td>inset-after
984-
<td>inset-after
985-
</tr>
986-
<tr>
987-
<td>bottom
988-
<td>inset-after
989-
<td>inset-after
990-
<td>inset-end
991-
<td>inset-start
992-
<td>inset-end
993-
<td>inset-start
994-
</tr>
995-
<tr>
996-
<td>left
997-
<td>inset-start
998-
<td>inset-end
999-
<td>inset-after
1000-
<td>inset-after
1001-
<td>inset-before
1002-
<td>inset-before
1003-
</tr>
1004-
</tbody>
1005-
</table>
1006-
<figcaption>
1007-
Relationship of physical inset edges and the logical properties per
1008-
'writing-mode' and 'direction'.
1009-
</figcaption>
1010-
</figure>
1011-
1012-
Issue: The logical property definitions should move to the Logical Properties module.
1013-
1014-
For relatively positioned boxes,
1015-
the inset is with respect to
1016-
the property’s corresponding physical reference edge of the box itself
1017-
(i.e., the box is given a position in the <a>normal flow</a>,
1018-
and then offset from that position according to the property).
1019-
1020-
Issue: This needs to be defined for sticky positioning.
1021-
1022-
For absolutely positioned elements
1023-
whose <a>containing block</a> is based on a block-level element,
1024-
this property is an inset from the corresponding padding edge of that element.
842+
<pre class="propdef">
843+
Name: inset
844+
Value: <'top'>{1,4}
845+
Initial: auto
846+
Applies to: positioned elements
847+
Inherited: no
848+
Percentages: see individual properties
849+
Computed value: see individual properties
850+
Animation type: by computed value type
851+
</pre>
1025852

1026-
Note: For fixed positioned elements,
1027-
using large values or negative values
1028-
can easily move elements outside the <a>viewport</a>
1029-
and make the contents unreachable through scrolling or other means.
1030-
Authors should be aware that fixed position elements
1031-
are always relative to the <span>initial containing block</span>.
853+
The 'inset' property is a [=shorthand property=]
854+
that sets all of the [=inset properties=]
855+
in a single declaration,
856+
assigning values to the longhands representing each side
857+
exactly as the 'margin' property does for its longhands.
1032858

1033859
<h2 id="size-and-position-details">
1034860
Sizing and positioning details</h2>

0 commit comments

Comments
 (0)