I need some basic help with flexbox
. The question has probably been asked, but I couldn't find it anywhere.
I have a container div
set to display: flex;
with an unknown amount of children, like so:
<div class="container">
<div class="child">First child</div>
<div class="child">Second child</div>
...
<div class="child">Nth child</div>
</div>
Now, I need every child to have the same width. In order to do that, I was thinking to use flex: 0 0 ?
. My question is what should I replace ?
with ? In an ideal world, I would set :
flex: 0 0 calc(100/n)%;
where n
would be the amount of children. The thing is, I don't know n
(how many children <div class="container">
has) in advance.
PS: I'm developing an interface in ReactJS. I've only shown HMTL code for better readability. All solutions are welcome, but CSS-only are preferred to ReactJS ones.