<ul>
  <li class="class1">
    <div class="custom">text1</div>
  </li>
  <li class="class1">
    <div class="custom">text2</div>
  </li>
  <li class="class1">
    <div class="custom">text3</div>
  </li>
  <li class="class1">
    <div>text4</div>
  </li>
  <li class="class1">
    <div>text5</div>
  </li>
</ul>
How do I select last div with class="custom"? I have to add border-bottom to div with text3. I tried:
.class1 .custom:last-of-type {
  border-bottom: 1px solid;
}
...But then border-bottom is added to all div's with class="custom".
I need CSS solution only, no JS. Also there could be any amount of <li> so I can't use :nth-child().
Update:
This layout is generated from Prime NG component <p-autocomplete>
The code is:
<p-autocomplete ....>
  <ng-template let-item pTemplate="item">
    <div [ngClass]="{'custom'}: item.isCustom">
      {{item.name}}
    </div>
  </ng-template>
</p-autocomplete>
 
     
    