Set the flex items vertically with CSS

To set the flex items vertically, use the flex-direction property. You can try to run the following code to display flex items vertically


Live Demo

<!DOCTYPE html>
         .mycontainer {
            display: flex;
            flex-direction: column;
            background-color: orange;
         .mycontainer > div {
            background-color: white;
            text-align: center;
            line-height: 40px;
            font-size: 25px;
            width: 100px;
            margin: 5px;
      <div class = "mycontainer">
Samual Sam
Samual Sam

Learning faster. Every day.