I know float is no more used and is replaced by flex but just curious to know why does it loose parent styles when implemented.
Example:
h1 {
margin: 0;
}
.container {
background-color: tan;
}
.one,
.two,
.three {
float: left;
width: 300px;
height: 200px;
text-align: center;
padding: 7px;
background-color: thistle;
border: 1px solid slategrey;
}
<div class="container">
<div class="one">
<h1>Section 1</h1>
</div>
<div class="two">
<h1>Section 2</h1>
</div>
<div class="three">
<h1>Section 3</h1>
</div>
</div>
In the above example the background color of container div doesnt work anymore after float is imoplemented !