Flexbox: Is it possible to force 100% width on a div with space-between daughter in parent?

2

I'm having the following problem, I have a parent div encompassing three elements, and it has the css:

.pai{
    display:flex;
    justify-content:space-between;
    width:400px;
}

But I wanted the first child to occupy 100% of the div and the other two to have space-between , you can force it to occupy 100% even with justify-content in parent ?

    
asked by anonymous 24.08.2017 / 15:02

1 answer

1

You can force size, no problem:

.pai {
  display: flex;
  justify-content: space-between;
  width: 400px;
  flex-wrap: wrap;
}

.filha {
  background-color: green;
  padding: 1rem;
  margin: 1rem;
  text-align: center;
  width: 100px;
}
.filha:first-of-type {
  width: 100%;
}
<div class="pai">
  <div class="filha">Teste</div>
  <div class="filha">Teste</div>
  <div class="filha">teste</div>
</div>
    
24.08.2017 / 15:10