<div class="flex">
<div class="w20">1</div>
<div class="w20">2</div>
<div class="w20 berth">3</div>
<div class="w20 berth">4</div>
<div class="w20 berth">5</div>
</div>
.first {
color: red;
}
const berths = document.querySelectorAll('.flex .berth');
berths[0].classList.add('first');
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.