diff --git a/css-values-5/Overview.bs b/css-values-5/Overview.bs index e1fcb56a7da..d165d12ce0c 100644 --- a/css-values-5/Overview.bs +++ b/css-values-5/Overview.bs @@ -945,8 +945,51 @@ Generating/Caching Random Values: the <> value + + +

+Counting Elements

+ + Authors often want to apply element specific styles + based on the position of the element within the tree. + + The ''sibling-index()'' and ''sibling-count()'' functions + (the element counting functions) + allow authors to take these factors into account in ''calc()'' expressions. + + With these, authors can create things like staggered animation delays + or easily position elements on a circle. + + These functions are substituted with whatever value they resolve to + at [=computed value=] time. + +

+Getting the position of an element within its siblings: the ''sibling-index()'' function

+ + The sibling-index() function resolves to the position + of an element within its group of inclusive siblings + in the flat tree. + + Similar to '':nth-child()'', the list of elements is 1-indexed; + that is, the first child of an element has index 1. + +

+Getting the number of siblings an element is part of: the ''sibling-count()'' function

+ The sibling-count() function resolves to the total number of + inclusive siblings in the flat tree an element is part of. + That is, it resolves to + the total number of direct children the element’s parent element contains, + after flattening.