Set the flex items horizontally with CSS

Use the flex-direction property with row value to set the flex-items horizontally.


You can try to run the following code to implement the row value −

Live Demo

<!DOCTYPE html>
         .mycontainer {
            display: flex;
            flex-direction: row;
            background-color: #2C3E50;
         .mycontainer > div {
            background-color: #F7F9F9;
            text-align: center;
            line-height: 40px;
            font-size: 25px;
            width: 100px;
            margin: 5px;
      <div class="mycontainer">