Public
Edited
Oct 7, 2023
Insert cell
Insert cell
<div class="root">
<div>
<div class="item foo">foo</div>
<div class="item foo">foo</div>
<div class="item foo bar">bar</div>
<div class="item foo">foo</div>

</div>
<div>
<div class="item foo bar">bar</div>
</div>
</div>
Insert cell
{
var element = document.querySelector(".item");

// Get the content property of the ::after pseudo-element
var afterContent = window
.getComputedStyle(element, ":after")
.getPropertyValue("content");
return afterContent;
}
Insert cell
<style>
.root {
counter-reset: item;
}

.item:not(.bar) {
counter-increment: item;
}

.item::after {
content: "[" counter(item) "]";
}
</style>
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more