Parent Height doesn’t follow their float children [duplicate]
Add overflow:hidden; to the container: #mainContainer{ width: 1000px; /*height: 1000px;*/ height:auto; margin-left:auto; margin-right:auto; background-color: #ff6600; padding-bottom: 20px; overflow: hidden; /* <— here */ } Because its content is floated, the container div collapses. Using a ‘clearfix’ class or, as I mentioned, adding overflow:hidden will cause the container to contain the floated elements. UPDATE Explanation of … Read more