html - What is a straightforward solution to vertically centering on a webpage? -


i've seen lot of discussion , debate on solutions pure css pure html. can pretty complicated, nesting divs within divs, using pretty intense looking css. figured i'd ask though, because need straightforward solution problem, , needs not rely on css tables (i.e. {display:table;} because i'm using show/hide entire div , solutions using never seem work nicely other code. how should this?

i came solution. i'm not sure it's best or compatible, here is:

<style type="text/css">   table.center {     width: 100%;     height: 100%;   }   h1.center {     text-align: center;   } </style>  <div id="hide-able">   <table class="center">     <tr><td><h1 class="center">i'm centered!</h1></td></tr>   </table> </div> 

if have better solution, please share!


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -