Div doesn't appear without css width property defined

Tell us what’s happening:
Why don’t we see the div elements without the width property specified??

Your code so far


<style>
#box-container {
  display: flex;
  height: 500px;
  flex-direction: row;
}

#box-1 {
  background-color: dodgerblue;
  height: 200px;
  
}

#box-2 {
  background-color: orangered;
  height: 200px;

}
</style>

<div id="box-container">
<div id="box-1"></div>
<div id="box-2"></div>
</div>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36.

Challenge: Use the flex-grow Property to Expand Items

Link to the challenge:

The browser created the divs, but because they have no content nor width specified they are effectively “invisible” since they take no space.

1 Like