1

I have a parent element It has 5 children (it could be any amount cause it is dynamic, but this is the current case)

<div class="parent">
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
</div>

The parent element has the following css applied to it

.parent {
    height: 48px;
    line-height: 24px;
    flex-wrap: wrap;
    flex-flow: column;
    display: flex;

}

The child has these styles

.child {
    width: 116px;
    align-items: center;
}

The issue is that the parent only has the width of one child (116px) even though it has three columns each being 116px wide.

Any help is appreciated.

Thanks

Shmili Breuer
  • 3,927
  • 2
  • 17
  • 26

1 Answers1

0

Put the flex-wrap: wrap below the flex-flow:column, this will solve the issue. Or just simply remove the flex-flow:column because it will conflict to the flex-wrap: wrap.

Please see below:

.parent {
    height: 48px;
    line-height: 24px;
    display: flex;
    flex-flow: column;
    flex-wrap: wrap;
}

.child {
    width: 116px;
    align-items: center;
  border: 1px solid;
}
<!-- flex-wrap below flex-column -->

<div class="parent">
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
</div>

.parent {
    height: 48px;
    line-height: 24px;
    display: flex;
    flex-wrap: wrap;
}

.child {
    width: 116px;
    align-items: center;
  border: 1px solid;
}
<!-- no flex-column -->

<div class="parent">
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
    <div class="child">Some text</div>
</div>
jmc
  • 660
  • 5
  • 14