Home › Forums › Support › How to vertically center a single div This topic has 5 replies, 3 voices, and was last updated 6 years, 7 months ago by Tom. Viewing 6 posts - 1 through 6 (of 6 total) Author Posts June 21, 2016 at 7:40 am #203545 Roberto Enrique I’m on this situation: View post on imgur.com i need to center the “left” div-50 relatively to the parent grid container. View post on imgur.com 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 June 21, 2016 at 9:00 am #203559 TomLead Developer Lead Developer You might want to look into Flexbox – it’s a pretty badass new method in HTML5/CSS3: https://www.kirupa.com/html5/centering_vertically_horizontally.htm https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/ https://davidwalsh.name/css-vertical-center-flexbox Let me know if you need more info 🙂 June 21, 2016 at 9:57 am #203581 Roberto Enrique 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/ This reply was modified 7 years, 9 months ago by Roberto Enrique. June 21, 2016 at 4:42 pm #203661 TomLead Developer Lead Developer Flexbox is awesome. If you need support for old versions of IE, take a look at flexibility: https://github.com/10up/flexibility August 26, 2017 at 4:55 pm #373960 Alex 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? August 27, 2017 at 12:02 am #374056 TomLead Developer Lead Developer It’s using flexbox. This might help: https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/ Author Posts Viewing 6 posts - 1 through 6 (of 6 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In