2

I'm trying to use display: flex instead of float: left to position paragraphs next to each other in div, and then I would like to position all paragraphs in this div to the center of the screen (currently with both display: flex and float: left they are positioned to the left of the screen)

I'm trying to use:

#div {display: flex; align-items: center;}

in my css but it's not doing the trick.

Can someone more experienced give me a tip on how to do it ? I've been fiddling with all different properties - no matter what I do, text binds to the left.

https://jsfiddle.net/e7bft0eL/

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701

1 Answers1

2

Just add justifiy-content property

The justify-content property aligns the flexible container's items when the items do not use all available space on the main-axis (horizontally).

#test{
    display: flex;
    background-color: white;
    align-items: center;
    justify-content: center;
}

jsfiddle

Keammoort
  • 3,075
  • 15
  • 20