I am currently using the jQuery center plugin to center my div element and so far it works to an extend where it does center it to the containing parent container. What I want
No plug-in is needed. This does the trick:
$('#yourElement').css('display', 'inline-block').wrap('
');
Live demo: http://jsfiddle.net/simevidas/EnrLn/1/
Same thing, but without the TABLE element. I use DIV's with display:table
and display:table-cell
instead:
Live demo: http://jsfiddle.net/simevidas/EnrLn/2/