Align flex items at the center of the container with CSS

CSSHTMLWeb DevelopmentFront End Technology

Use the justify-content property with value center to align the flex-items to the center.


You can try to run the following code to implement the center value

Live Demo

<!DOCTYPE html>
         .mycontainer {
            display: flex;
            background-color: red;
            justify-content: center;
         .mycontainer > div {
            background-color: #F1C40F;
            text-align: center;
            line-height: 60px;
            font-size: 30px;
            width: 100px;
            margin: 5px;
      <div class = "mycontainer">
Published on 07-Jun-2018 09:16:15