Clearfix Vs last-child

When I use clearfix, it targets my after element rather than last child. Is there any other clearfix solution so I can easily use :last-child as expected?

.clearfix::after {
  content: "";
  clear: both;
  display: table;
}
Was this page helpful?