View Full Version : Vertical Alignment

Jun 3rd, 2010, 07:35 PM
Hi i bought a theme from themeforest.

I want to vertically align in middle the #silhoutte and #pages , the original developer was unable to do it, he gave me this code as wayaround but it still does'nt work perfectly in diff screen sizes.

var margin=$(window).height() / 100 * 15;
$('#pages').css('margin-top',margin + 'px');
$('#silhouette').css('top',margin + 'px');

(BTW currently this script is not implemented)

Is there any wayaround or is anyone here more better coder than the original developer? Please don't give answers like search google for vertical alignment, i already did, but am too confused how to implement if anybody would be kind enough to look in code and guide me on how i can do that i will be thankfull.

Jun 3rd, 2010, 09:52 PM
Have a look here. (http://www.exitfegs.co.uk/Sources.html) There is much about centre alignment.

Use the search facility.


Jun 3rd, 2010, 11:42 PM
If they have a defined height you can just position it absolute and give it a negative top margin which is half of it's height...

Otherwise if it's unknown height you can use the display:table solution found here: http://www.jakpsatweb.cz/css/css-vertical-center-solution.html

Looks to me as if the picture can be done with the first method but the right column will require the display:table method...