Separate div with clearfix in CSS

In fact, clearfix is ​​most often used as a separate div, which is placed before the div for which you want to cancel the overlap, like this:

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;
}

Результат: