Basic example

by yaero

HTML

<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type -->

<div class="a">
  <div>This element isn't counted.</div>
  <p>1st paragraph.</p>
  <p>2nd paragraph.</p>
  <div>This element isn't counted.</div>
  <p>3rd paragraph.</p>
  <p>4th paragraph.</p>
</div>

CSS

/* Odd paragraphs */
.a > *:nth-child(n + 3):nth-child(-n + 4) {
	color: red;
}

.a > *:nth-last-child(-n + 1) {
	color: blue;
}