<body>
  <div></div>
  <div></div>
  <div></div>
</body>
/* initialize the counter */
body {
	counter-reset: demoCounter;
}

/* increment the counter anywhere there's a div*/
div {
	counter-increment: demoCounter;
}

/* display the value of the counter before the element */
div:before {
	content: 'div ' counter(demoCounter);
}

div {
  font-size: 50px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.