I've been experimenting with using clearfix
instead of the clear both property, but it's not working as expected. Despite following tutorials, the issue persists.
How can I troubleshoot this and make it function properly?
* {
margin: 0;
padding: 0;
}
/* .first_div {
width:50%;
height:50%;
background-color:red;
margin: 50px auto;
overflow: auto;
}*/
.second_div {
width:50px;
height:50px;
background-color:green;
float: left;
}
.third_div {
width:50px;
height:50px;
background-color:blue;
}
.clearfix:after { content: "\00A0"; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
.clearfix{ display: inline-block;}
html[xmlns] .clearfix { display: block;}
* html .clearfix{ height: 1%;}
.clearfix {display: block}
<body>
<div class="clearfix">
<div class="second_div">sfddsf</div>
<div class="third_div">sfdsfds</div>
</div>
</body>