I’m trying to centralise a div (boxTest) within a div which is 100% width and height fixed.
below is the code and here’s a jsfiddle
html
<a href="#" class="clickme">CLICK ME</a>
jQuery
$( function() {
$(".clickme").click(function() {
$('body').append('<div class="videoMask" style="position:fixed; top:0; bottom:0; z-index:14000000; left:0; right:0; width:100%; height:100%; background-color:#000000;"></div><div id="boxTest" style=" width:150px; background:#FFFFFF; position:fixed; top:10px; z-index:15000000; height:150px; margin:0; padding:0;"><span class="closeMe">CLOSE</span></div>');
$('#boxTest').show();
});
$( ".closeMe, .videoMask" ).live('click', function() {
$( "#boxTest" ).remove();
$( ".videoMask" ).remove();
});
});
P.s the in line styles will be changed, I did it this way to make it a little easier to see on here.
Thanks in advance for any responses.
Try applying this style to #boxTest to center it horizontally…