.clearfix:after
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .clearfix:after{ content: "111"; display: block; clear: both; visibility: hidden; height: 0; } .c{ background-color: red; } .c .item{ float: left; } </style> </head> <body> <div class="c clearfix"> <div class="item">sg</div> <div class="item">dsg</div> </div> </body> </html>