<p></p>
<p></p>
<p></p>
p{
  width: 100px;
  height: 100px;
  margin: 10px;
  border: 1px solid #000;
  display: inline-block;
}
d3.selectAll("p").style("background", function(d, i) {
  return i % 2 ? "#fff" : "#000";
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/d3/6.7.0/d3.min.js