Skip to content

Commit 403eff4

Browse files
committed
[css-position-3] Rewrap the abspos width section.
1 parent e14b4b3 commit 403eff4

1 file changed

Lines changed: 108 additions & 64 deletions

File tree

css-position-3/Overview.bs

Lines changed: 108 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ Fixed positioning</h3>
694694
Sizing and positioning details</h2>
695695

696696
<h3 id="abs-non-replaced-width">
697-
The width of absolute or fixed positioned, non-replaced elements</h3>
697+
The Width of Absolutely-Positioned, Non-Replaced Elements</h3>
698698

699699
The constraint that determines the used values for these elements is:
700700

@@ -704,48 +704,68 @@ The width of absolute or fixed positioned, non-replaced elements</h3>
704704
'right' = width of containing block
705705
</code>
706706

707-
If all three of 'left', 'width', and 'right' are ''left/auto'': First set any ''margin/auto'' values
708-
for 'margin-left' and 'margin-right' to ''0''. Then, if the 'direction' property of the
709-
element establishing the static-position <a>containing block</a> is ''ltr'' set
710-
'left' to the static position and apply rule number <em>three</em> below; otherwise, set
711-
'right' to the static-position and apply rule number <em>one</em> below.
712-
713-
If none of the three is ''left/auto'': If both 'margin-left' and 'margin-right' are ''margin/auto'',
714-
solve the equation under the extra constraint that the two margins get equal values,
715-
unless this would make them negative, in which case when direction of the containing
716-
block is ''ltr'' (''rtl''), set 'margin-left' ('margin-right') to ''0'' and solve for
717-
'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is ''margin/auto'',
718-
solve the equation for that value. If the values are over-constrained, ignore the value
719-
for 'left' (in case the 'direction' property of the <a>containing block</a> is
720-
''rtl'') or 'right' (in case 'direction' is ''ltr'') and solve for that value.
721-
722-
Otherwise, set ''margin/auto'' values for 'margin-left' and 'margin-right' to ''0'', and pick
723-
one of the following six rules that apply.
707+
If all three of 'left', 'width', and 'right' are ''left/auto'':
708+
First set any ''margin/auto'' values for 'margin-left' and 'margin-right'
709+
to ''0''.
710+
Then, if the 'direction' property of
711+
the element establishing the static-position <a>containing block</a>
712+
is ''ltr'' set 'left' to the static position
713+
and apply rule number <em>three</em> below;
714+
otherwise, set 'right' to the static-position
715+
and apply rule number <em>one</em> below.
716+
717+
If none of the three is ''left/auto'':
718+
If both 'margin-left' and 'margin-right' are ''margin/auto'',
719+
solve the equation under the extra constraint that
720+
the two margins get equal values,
721+
unless this would make them negative,
722+
in which case when direction of the containing block is ''ltr'' (''rtl''),
723+
set 'margin-left' ('margin-right') to ''0''
724+
and solve for 'margin-right' ('margin-left').
725+
If one of 'margin-left' or 'margin-right' is ''margin/auto'',
726+
solve the equation for that value.
727+
If the values are over-constrained,
728+
ignore the value for 'left'
729+
(in case the 'direction' property of the <a>containing block</a> is ''rtl'')
730+
or 'right'
731+
(in case 'direction' is ''ltr'') and solve for that value.
732+
733+
Otherwise,
734+
set ''margin/auto'' values for 'margin-left' and 'margin-right' to ''0'',
735+
and pick one of the following six rules that apply.
724736

725737
<ol>
726738
<li>
727-
If 'left' and 'width' are ''left/auto'' and 'right' is not ''right/auto'', then the width is
728-
shrink-to-fit. Then solve for 'left'.
739+
If 'left' and 'width' are ''left/auto'' and 'right' is not ''right/auto'',
740+
then the width is shrink-to-fit.
741+
Then solve for 'left'.
729742

730743
<li>
731-
If 'left' and 'right' are ''left/auto'' and 'width' is not ''width/auto'', then if the
732-
'direction' property of the element establishing the static-position
733-
<a>containing block</a> is ''ltr'' set 'left' to the static-position,
734-
otherwise set 'right' to the static-position. Then solve for 'left' (if 'direction
735-
is ''rtl'') or 'right' (if 'direction' is ''ltr'').
744+
If 'left' and 'right' are ''left/auto'' and 'width' is not ''width/auto'',
745+
then if the 'direction' property of
746+
the element establishing the static-position <a>containing block</a>
747+
is ''ltr''
748+
set 'left' to the static-position,
749+
otherwise set 'right' to the static-position.
750+
Then solve for 'left' (if 'direction' is ''rtl'')
751+
or 'right' (if 'direction' is ''ltr'').
736752

737753
<li>
738-
If 'width' and 'right' are ''width/auto'' and 'left' is not ''left/auto'', then the width is
739-
shrink-to-fit. Then solve for 'right'.
754+
If 'width' and 'right' are ''width/auto'' and 'left' is not ''left/auto'',
755+
then the width is shrink-to-fit.
756+
Then solve for 'right'.
740757

741758
<li>
742-
If 'left' is ''left/auto'', 'width' and 'right' are not ''width/auto'', then solve for 'left'.
759+
If 'left' is ''left/auto'', 'width' and 'right' are not ''width/auto'',
760+
then solve for 'left'.
743761

744762
<li>
745-
If 'width' is ''width/auto'', 'left' and 'right' are not ''left/auto'', then solve for 'width'.
763+
If 'width' is ''width/auto'', 'left' and 'right' are not ''left/auto'',
764+
then solve for 'width'.
746765

747766
<li>
748-
If 'right' is ''right/auto'', 'left' and 'width' are not ''left/auto'', then solve for 'right'.
767+
If 'right' is ''right/auto'', 'left' and 'width' are not ''left/auto'',
768+
then solve for 'right'.
749769
</ol>
750770

751771
<table class=data id='abspos-auto'>
@@ -862,62 +882,86 @@ The width of absolute or fixed positioned, non-replaced elements</h3>
862882
<h3 id="abs-replaced-width">
863883
The width of absolute or fixed positioned, replaced elements</h3>
864884

865-
If 'height' and 'width' both have computed values of <css>auto</css> and the element also has an
866-
intrinsic width, then that intrinsic width is the used value of 'width'.
885+
If 'height' and 'width' both have computed values of <css>auto</css>
886+
and the element also has an intrinsic width,
887+
then that intrinsic width is the used value of 'width'.
867888

868-
If 'height' and 'width' both have computed values of <css>auto</css> and the element has no
869-
intrinsic width, but does have an intrinsic height and intrinsic ratio; or if 'width'
870-
has a computed value of <css>auto</css>, 'height' has some other computed value, and the element
871-
does have an intrinsic ratio; then the used value of 'width' is:
889+
If 'height' and 'width' both have computed values of <css>auto</css>
890+
and the element has no intrinsic width,
891+
but does have an intrinsic height and intrinsic ratio;
892+
or if 'width' has a computed value of <css>auto</css>,
893+
'height' has some other computed value,
894+
and the element does have an intrinsic ratio;
895+
then the used value of 'width' is:
872896

873897
<code>(used height) * (intrinsic ratio)</code>
874898

875-
If 'height' and 'width' both have computed values of <css>auto</css>, the element has an
876-
intrinsic ratio but no intrinsic height or width, and the <a>containing block’s</a> width does
877-
not itself depend on the replaced element’s width, then the used value of 'width' is
878-
calculated from the constraint equation used for
899+
If 'height' and 'width' both have computed values of <css>auto</css>,
900+
the element has an intrinsic ratio but no intrinsic height or width,
901+
and the <a>containing block’s</a> width
902+
does not itself depend on the replaced element’s width,
903+
then the used value of 'width' is calculated
904+
from the constraint equation used for
879905
<a href="https://www.w3.org/TR/CSS21/visudet.html#blockwidth">block-level, non-replaced elements in <a>normal flow</a></a>.
880906

881-
Otherwise, if 'width' has a computed value of <css>auto</css>, and the element has an intrinsic
882-
width, then that intrinsic width is the used value of 'width'.
907+
Otherwise, if 'width' has a computed value of <css>auto</css>,
908+
and the element has an intrinsic width,
909+
then that intrinsic width is the used value of 'width'.
883910

884-
Otherwise, if 'width' has a computed value of <css>auto</css>, but none of the conditions above
885-
are met, and then the used value of 'width' becomes ''300px''. If ''300px'' is too wide
886-
to fit the device, user agents should use the width of the largest rectangle that has a
887-
2:1 ratio and fits the device instead.
911+
Otherwise, if 'width' has a computed value of <css>auto</css>,
912+
but none of the conditions above are met,
913+
and then the used value of 'width' becomes ''300px''.
914+
If ''300px'' is too wide to fit the device,
915+
user agents should use the width of the largest rectangle
916+
that has a 2:1 ratio and fits the device instead.
888917

889-
After establishing the 'width', in order to position the replaced element, apply the
890-
following rules as appropriate.
918+
After establishing the 'width',
919+
in order to position the replaced element,
920+
apply the following rules as appropriate.
891921

892922
<ol>
893923
<li>
894-
If both 'left' and 'right' have the value <css>auto</css>, and if the 'direction' property
895-
of the element establishing the static-position <a>containing block</a> is
896-
''ltr'', set 'left' to the static position and solve for 'right'; else if
897-
'direction' is ''rtl'', set 'right' to the static position and solve for 'left'.
924+
If both 'left' and 'right' have the value <css>auto</css>,
925+
and if the 'direction' property of
926+
the element establishing the static-position <a>containing block</a>
927+
is ''ltr'',
928+
set 'left' to the static position and solve for 'right';
929+
else if 'direction' is ''rtl'',
930+
set 'right' to the static position and solve for 'left'.
898931

899932
<li>
900-
If 'left' is <css>auto</css> and 'right' is not <css>auto</css>, replace any <css>auto</css> on
901-
'margin-left' or 'margin-right' with ''0'', then solve for 'left'.
933+
If 'left' is <css>auto</css> and 'right' is not <css>auto</css>,
934+
replace any <css>auto</css> on 'margin-left' or 'margin-right'
935+
with ''0'',
936+
then solve for 'left'.
902937

903938
<li>
904-
If 'right' is <css>auto</css> and 'left' is not <css>auto</css>, replace any <css>auto</css> on
905-
'margin-left' or 'margin-right' with ''0'', then solve for 'right'.
939+
If 'right' is <css>auto</css> and 'left' is not <css>auto</css>,
940+
replace any <css>auto</css> on 'margin-left' or 'margin-right'
941+
with ''0'',
942+
then solve for 'right'.
906943

907944
<li>
908-
If at this point both 'margin-left' and 'margin-right' are still <css>auto</css>, solve the
909-
equation under the extra constraint that the two margins must get equal values,
910-
unless this would make them negative, in which case when the direction of the
911-
<a>containing block</a> is ''ltr'' (''rtl''), set 'margin-left'
912-
('margin-right') to ''0'' and solve for 'margin-right' ('margin-left').
945+
If at this point both 'margin-left' and 'margin-right'
946+
are still <css>auto</css>,
947+
solve the equation under the extra constraint
948+
that the two margins must get equal values,
949+
unless this would make them negative,
950+
in which case when the direction of the <a>containing block</a>
951+
is ''ltr'' (''rtl''),
952+
set 'margin-left' ('margin-right') to ''0''
953+
and solve for 'margin-right' ('margin-left').
913954

914955
<li>
915-
If at this point there is an <css>auto</css> remaining, solve the equation for that value.
956+
If at this point there is an <css>auto</css> remaining,
957+
solve the equation for that value.
916958

917959
<li>
918-
If at this point the values are over-constrained, ignore the value for either 'left'
960+
If at this point the values are over-constrained,
961+
ignore the value for either 'left'
919962
(in case the 'direction' property of the <a>containing block</a> is ''rtl'')
920-
or 'right' (in case 'direction' is ''ltr'') and solve for that value.
963+
or 'right' (in case 'direction' is ''ltr'')
964+
and solve for that value.
921965
</ol>
922966
<!-- End section: The width of absolute or fixed positioned, replaced element -->
923967

0 commit comments

Comments
 (0)