You need to apply the flex properties to the <ul>
ul {
display: flex;
flex-direction: row; <-- not needed as this is the default behavior
flex-wrap: wrap;
}
Putting the properties on the <div> tells it to display the <ul> in flex, not <li>.