child div goes outside parent div

23,414

Solution 1

Be more specific. Where is the problem on the website?

Try to add this to css, so parent will know about the size of the child element:

#parent{
   overflow:hidden;
}

Solution 2

You need to clear after your float.

Try adding this css:

CSS

.container:after {
    content: "";
    display: table;
    clear: both;
}
Share:
23,414
Suraj Hazarika
Author by

Suraj Hazarika

Updated on November 17, 2020

Comments

  • Suraj Hazarika
    Suraj Hazarika over 3 years

    Currently I am designing a website using CSS and HTML etc. But I have faced a problem there : my child div goes outside the parent div when I add floating to the child. The site resides here my web design