@@ -17,6 +17,7 @@ Default Highlight: css
17
17
</pre>
18
18
<pre class='link-defaults'>
19
19
spec: css-values-4; type: dfn; text: determine the type of a calculation
20
+ spec: selectors-4; type: dfn; text: selector
20
21
</pre>
21
22
<style>
22
23
code, small { white-space: nowrap }
@@ -1403,6 +1404,37 @@ Generating/Caching Random Values: the <<random-caching-options>> value</h4>
1403
1404
1404
1405
1405
1406
1407
+ <h2 id="tree-counting">
1408
+ Tree Counting Functions: the ''sibling-count()'' and ''sibling-index()'' notations</h2>
1409
+
1410
+ The <dfn>sibling-count()</dfn> [=functional notation=] represents,
1411
+ as an <<integer>> ,
1412
+ the total number of child <l spec=css-display-3> [=elements=] </l>
1413
+ in the parent of the element on which the notation is used.
1414
+
1415
+ The <dfn>sibling-index()</dfn> [=functional notation=] represents,
1416
+ as an <<integer>> ,
1417
+ the index of the element
1418
+ on which the notation is used
1419
+ among the children of its parent.
1420
+ Like '':nth-child()'' ,
1421
+ ''sibling-index()'' is 1-indexed.
1422
+
1423
+ Note: The ''counter()'' function can provide similar abilities as ''sibling-index()'' ,
1424
+ but returns a <<string>> rather than an <<integer>> .
1425
+
1426
+ When used on a [=pseudo-element=] ,
1427
+ these both resolve as if specified
1428
+ on its [=ultimate originating element=] .
1429
+
1430
+ Note: Like the rest of CSS (other than [=selectors=] ),
1431
+ ''sibling-count()'' and ''sibling-index()''
1432
+ operate on the [=flat tree=] .
1433
+
1434
+ Note: These functions may, in the future,
1435
+ be extended to accept an ''of <<selector>>'' argument,
1436
+ similar to '':nth-child()'' ,
1437
+ to filter on a subset of the children.
1406
1438
1407
1439
<!--
1408
1440
████████ ████████ ██████
0 commit comments