Before jquery we struggled a lot to get div content vertically center in all browsers. But the wait is over; now we can have div content vertically centered with the help of a small jquery function.
Here is the Demo –
Here is the Demo –
I tried your code. But a CSS solution worked:
ReplyDeleteThis fixed the problem. Knowing the height and width of the control, I used
http://css-tricks.com/320-quick-css-trick-how-to-center-an-object-exactly-in-the-center/
@Bill Thompson
ReplyDeleteThe solution you used is good for static content. If you have dynamic website and the content keeps on changing, css-trick will not work. If you want to calculate correct center position without any static adjustments, you will find this post helpful.
It's great that jQuery makes vertical centering divs so much easier.
ReplyDelete