How to align flexbox columns left and right with CSS?

Spread the love

Sometimes, we want to align flexbox columns left and right with CSS.

In this article, we’ll look at how to align flexbox columns left and right with CSS.

How to align flexbox columns left and right with CSS?

To align flexbox columns left and right with CSS, we set the justify-content property.

For instance, we write

#container {
  width: 500px;
  border: solid 1px #000;
  display: flex;
  justify-content: space-between;
}

to add display: flex; to make the element with ID container a flex container.

Then we add justify-content: space-between; to make the content inside spread to the left and right side.

Conclusion

To align flexbox columns left and right with CSS, we set the justify-content property.

Leave a Reply

Your email address will not be published. Required fields are marked *