shukmeister shukmeister - 7 months ago 24
HTML Question

Flexbox child overflowing into other rows

I am trying to divide a practice website into three sections of a column using flexbox. However, the middle section overflows out of the flexbox row, and the footer section is now hidden behind it.

https://jsbin.com/rerulepawu/edit?html,output

What causes this? I experimented with flex-grow and flex-shrink but it did not help.

Any advice would be appreciated. Thanks.

Answer

text in flexboxes usually overlap within the flex container to fix this you can set

.row {
    flex: 1;
    display: flex;
    overflow:auto;
    min-height: min-content;

}

and as a hack I set a non flex span inside a flex div, and set it's display to block btw everything goes to crap when you delete it because Justify content dictates position within a flew box, if your whole site is one big flex box.

this is the full CSS that works for me displaying footer

  body {
    background-color: rgb(64, 160, 223);
    font-family: 'Futura', sans-serif;
    color: white;
}

.column {
    display: flex;
    height: 93%;
    flex-direction: column;

}

.row {
    flex: 1;
    display: flex;
  overflow:auto;
}

.block {
    margin: auto;
}

.section_block {
    margin: 20px;
    height: 100px;
}

.section_left {
    background-color: yellow;
    width: 50%;
    float: left;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center
}

.section_right {
    background-color: red;
    width: 50%;
    float: left;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center
}

.section_title {
    font-weight: bold;
}

.section_description {
    text-align: center;
    vertical-align: middle;
}

.section_photo {
   margin: 0
}

.content {
    border-radius: 15px;
    background-color: white;
    width: 80%;
    color: black;
    display: flex;
    flex-direction: column;
}

/*  why does everything go to shit when i delete this */


#contact {overflow:auto;
    flex: 0;
    justify-content: flex-end;}