Oddzielny div z clearfix w CSS

W rzeczywistości clearfix jest najczęściej używany w postaci oddzielnego diva, który jest umieszczany przed tym divem, dla którego chcesz anulować nakładanie się, w ten sposób:

html<div class="parent">
  <img src="img.png" alt="">
  text
</div>
<div class="clearfix"></div>
<div class="parent">
  text
</div>
css.parent {
  border: 1px solid red;
}
.parent img {
  float: left;
}

.clearfix {
  clear: both;
}

Результат: