I am new in learning CSS and while I am training to create a navigation bar using just a few declarations of CSS I did not know I faced this problem with this code enter image description here
After overflow: hidden in the parent of the children the problem was fix. My question is that how and why overflow can fix this problem I know that overflow is just for the text that flow out of a box
.parent {
background-color: rgb(10, 64, 85);
padding: 20px;
overflow: hidden;
}
.parent div {
color: white;
text-align: center;
background-color: rgb(0, 105, 153);
padding: 10px;
width: calc((100% / 6) - 24px);
display: inline-block;
float: left;
margin: 0px 2px;
font-size: 20px;
}