I have this HTML structure:
<div class="metaboxdet">
<div class="metd">
<h1>Hello World!</h1>
</div>
</div>
http://jsfiddle.net/fvueL00n/2/
the problem here is I cant center the div "metd" horizontally and vertically. I have tried adjusting the top, bottom, left and right but it return a not so accurate results. Is there a way where i can center horizontally and vertically dynamically.
please check the fiddle here to see it in action. Thanks!
As discussed in this answer, you can add a helper element with
height:100%
anddisplay:inline-block
withvertical-align:middle
, and change the container to bedisplay:inline-block
withvertical-align:middle
Here's the code in action