@@ -767,11 +767,16 @@ Size Container Features</h3>
767767
768768 [=Relative length=] units
769769 (including [=container query length=] units)
770+ and [=custom properties=]
770771 in [=container query=] conditions
771772 are evaluated based on the the [=computed values=] of the [=query container=] .
772773
773774 Note: This is different from the handling of relative units in [=media queries=] .
774775
776+ Note: If [=custom property=] substitution results in an invalid value for the
777+ [=size feature=] , it is handled the same as other invalid feature values,
778+ and the result of the [=size feature=] is ''unknown'' .
779+
775780 <div class=example>
776781 For example, [=query containers=] with different font-sizes
777782 will evaluate ''em'' -based queries relative to their own font sizes:
@@ -799,6 +804,33 @@ Size Container Features</h3>
799804 the query condition will be true above ''960px'' .
800805 </div>
801806
807+ <div class=example>
808+ Similarly, [=query containers=] will evaluate ''var()'' -based queries
809+ relative to their own [=computed value=] of the [=custom property=] :
810+
811+ <pre class=lang-css>
812+ aside, main {
813+ container-type: inline-size;
814+ }
815+
816+ aside { --query: 300px; }
817+ main { --query: 500px; }
818+
819+ @container (width > var(--query)) {
820+ h2 { font-size: 1.5em; }
821+ }
822+ </pre>
823+
824+ The ''var(--query)'' value used in the query condition
825+ is substituted with the [=computed value=] of
826+ the ''--query'' [=custom property=] on the relevant [=query container=] :
827+
828+ * For any ''h2'' inside ''aside'' ,
829+ the query condition will be true above ''300px'' .
830+ * For any ''h2'' inside ''main'' ,
831+ the query condition will be true above ''500px'' .
832+ </div>
833+
802834<h4 id="width">
803835Width: the '@container/width' feature</h4>
804836
@@ -1128,6 +1160,8 @@ Changes since the 18 August 2022 Working Draft</h3>
11281160 (<a href="https://github.com/w3c/csswg-drafts/issues/7669">Issue 7669</a> )
11291161 * Make the 'content-visibility' property animatable.
11301162 (<a href="https://github.com/w3c/csswg-drafts/issues/8627">Issue 8627</a> )
1163+ * Allow ''var()'' references in [=container size queries=] .
1164+ (<a href="https://github.com/w3c/csswg-drafts/issues/8088">Issue 8088</a> )
11311165
11321166<h3 id="changes-2021-12">
11331167Changes since the 21 December 2021 First Public Working Draft</h3>
0 commit comments