Site logo

Archived topic

How to vertically center a single div

5 replies · Started by Roberto Enrique on June 21, 2016

Viewing posts 1–6 of 6

I'm on this situation:

https://i.imgur.com/JeZINcC.png

i need to center the "left" div-50 relatively to the parent grid container.

https://i.imgur.com/enCeWjU.png

I have been trying a lot of js tricks but none seems to work.
Do you have a "best-practice" to accomplish this or should I desist?

Thanks in advance

Thanks!

It was so easy

I added a class to the grid-container

<div class="grid-container flex-vertical"></div>

and then the css:


    .flex-vertical{
	display: -ms-flexbox;
	display: -webkit-flex;
	display: flex;
  		
        -ms-flex-align: center;
	-webkit-align-items: center;
	-webkit-box-align: center;

	align-items: center;
    }

And it works beautifully

http://filippogismondo.artomultiplo.net/

Hey Tom, how does the "Vertically Align Content" feature work in the Page Header > Content options? When you switch it on, it seems to center any text vertically.

Could I somehow use this elsewhere by calling the class that is powering this option?

This archived topic is closed to new replies.