<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/get-item-index-and-item-count-in-css-scygrpmxv" -->

---
title: Get item index and item count in CSS | daily.dev
description: New CSS functions sibling-index() and sibling-count() let an element know its position among siblings and how many siblings exist in total. Beyond simple...
canonical: https://daily.dev/posts/get-item-index-and-item-count-in-css-scygrpmxv
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Get item index and item count in CSS | daily.dev
og:description: New CSS functions sibling-index() and sibling-count() let an element know its position among siblings and how many siblings exist in total. Beyond simple...
og:url: https://daily.dev/posts/get-item-index-and-item-count-in-css-scygrpmxv
og:image: https://api.daily.dev/og/posts/ScygRpMXv.png
og:image:alt: Get item index and item count in CSS
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get item index and item count in CSS

**[Byte Corner](https://daily.dev/sources/bytecorner)** · [@mbos](https://daily.dev/mbos) · 1 min read · 4 upvotes · 0 comments

## Summary

New CSS functions sibling-index() and sibling-count() let an element know its position among siblings and how many siblings exist in total. Beyond simple numbering, these values can be used to drive dynamic layouts and animations, with a linked demo showing practical usage.

## Content

`sibling-index()` can tell an element its position.

`sibling-count()` can tell it how many siblings there are.

What starts as a simple way to number elements gets much more interesting when you use those values to drive dynamic layouts and animations.

[👉 Read More about it here 👈](https://bytecorner.dev/articles/sibling-index-and-sibling-count)

#CSS3 #Web Development

## Similar posts on daily.dev

- [CSS sibling-index\(\) and sibling-count\(\): Native List Staggering Without JavaScript](https://daily.dev/posts/css-sibling-index-and-sibling-count-native-list-staggering-without-javascript-bsxh6wlwk) · SitePoint · 61 upvotes · 2 comments
- [Advanced Tree Counting: Mathematical Layouts With sibling-index\(\) And sibling-count\(\) — Smashing Magazine](https://daily.dev/posts/advanced-tree-counting-mathematical-layouts-with-sibling-index-and-sibling-count-smashing-mag-50edoejtv) · Smashing Magazine · 13 upvotes · 1 comments
- [Counting Elements in CSS: Using Sibling-Count and Hacks](https://daily.dev/posts/counting-elements-in-css-using-sibling-count-and-hacks-fyrhrhsyv) · Frontend Masters · 2 upvotes · 0 comments

---

Tags: [#css](https://daily.dev/tags/css)

[View this post on daily.dev](https://daily.dev/posts/get-item-index-and-item-count-in-css-scygrpmxv)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/get-item-index-and-item-count-in-css-scygrpmxv","headline":"Get item index and item count in CSS","text":"New CSS functions sibling-index() and sibling-count() let an element know its position among siblings and how many siblings exist in total. Beyond simple numbering, these values can be used to drive dynamic layouts and animations, with a linked demo showing practical usage.","url":"https://daily.dev/posts/get-item-index-and-item-count-in-css-scygrpmxv","datePublished":"2026-10-01T19:31:49.053Z","dateModified":"2026-10-02T15:59:17.698Z","author":{"@type":"Person","name":"Matej Bošnjak","url":"https://daily.dev/mbos","image":"https://lh3.googleusercontent.com/a/ACg8ocIAnljz4vtpgYdXGAdl9NuMuQ8mAa6J_OteOt91EfP2WNlcicOw=s96-c","description":"Full Stack Developer","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":1980}},"image":"https://media.daily.dev/image/upload/s--QSjUXPO8--/f_auto/v1790883109/posts/ScygRpMXv?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/bytecorner","name":"Byte Corner"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Byte Corner","item":"https://daily.dev/squads/bytecorner"},{"@type":"ListItem","position":3,"name":"Get item index and item count in CSS"}]}
```

