.dcss-greatest-index
Tells you where the greatest item sits in a list, counting from 0.
Example
Result
Markup
<link rel="stylesheet" href="dcss.css">
<link rel="stylesheet" href="families/array.css">
<link rel="stylesheet" href="families/format.css">
<figure class="dcss-greatest-index">
<ol>
<li style="--value: 3"></li>
<li style="--value: 2"></li>
<li style="--value: 1"></li>
<li style="--value: 1"></li>
<li style="--value: 6"></li>
<li style="--value: 2"></li>
<li style="--value: 4"></li>
</ol>
<div>
<output class="dcss-format-fixed" style="--value: var(--dcss-greatest-index); --precision: 0"></output>
</div>
</figure>
Browser support
| Browser | Support |
|---|---|
| Chrome | Yes |
| Safari | Yes |
| Firefox | Whole numbers only |
See also
d3.greatestIndexin d3’s documentationmaxIndex()with CSS layout alone