#How can I center these items vertically?

7 messages · Page 1 of 1 (latest)

peak umbra
#

Hey guys,
I want to center the two divs with the white borders, but nothing works.
The first row includes a h2 and a p element. On the next line are three p elements and a button. My plan was to add a display flex on the divs and align items to center. The problem is that only the button centers vertically. The p elements are just staying at the bottom. Where is my problem? This works all the time.

strong edge
#

Without seeing the code I will assume it needs '''justify-content: center;'''

peak umbra
#

I don’t have any code yet, because everything I tried did not work.

#

But I don’t want to center it horizontally - just vertically

strong edge
#

no html? Perhaps css display: flex; flex-direction: column; justify-content: center; align-items: center; to center it on the site. Leave off align-items if you do not want it horizontally center; flex-direction defines the direction of the main axis. Hope it helps.

peak umbra
#

Oh god I am so dumb.

#

Right before going to bed I just thought about checking my code again and I had a padding-top for all p elements. That’s the reason why I couldn’t center them.