hackalive Posted December 4, 2011 Share Posted December 4, 2011 Hi guys, I am trying to vertical center a div of which i know the height (height: 4in;) I cannot seem to get it to work. PS it MUST use "inches" as the unit of measurement, any help is greatly appreciated. Cheers in advance. Quote Link to comment https://forums.phpfreaks.com/topic/252443-vertical-center/ Share on other sites More sharing options...
jonathonedney Posted December 4, 2011 Share Posted December 4, 2011 hackalive, I would assume setting top and bottom margin values of auto would correct this, but I can't be certain. I found this article, maybe it will help you. http://blog.themeforest.net/tutorials/vertical-centering-with-css/ Quote Link to comment https://forums.phpfreaks.com/topic/252443-vertical-center/#findComment-1294309 Share on other sites More sharing options...
hackalive Posted December 4, 2011 Author Share Posted December 4, 2011 Thanks jonathonedney! Quote Link to comment https://forums.phpfreaks.com/topic/252443-vertical-center/#findComment-1294316 Share on other sites More sharing options...
haku Posted December 6, 2011 Share Posted December 6, 2011 <div id="outer"> <div id="inner"> some content </div> </div> #outer { height:500px; padding-top:50%; } #inner { height:100px; margin-top:-50%; } Try that. Quote Link to comment https://forums.phpfreaks.com/topic/252443-vertical-center/#findComment-1294798 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.