Curtis
Posts: 0
Joined: Wed Sep 26, 2012 4:51 pm

Center images javascript only works for some of the images.

I have a page that I have placed 8 images to be used as buttons. I want them centered so it doesn't matter what device I am using.

I used the code for all of the images (changed to reflect their individual names):
$('.mobileimage194_div').css('margin', 'auto');
$('.mobileimage194_div').css('align', 'center');

I was/am having strange problems.

  1. The first image of the group is left justified. I fixed this by adding a 1 pixel high image to the page. It is still being left justified (despite having the appropriate code), but at least I can't see it.

  2. After image 7, the rest are left justified. I have used the 1 pixel trick as mentioned above, but it doesn't work. The code is in place for all of the images. I have tried about every variation I can think of.

    A grid is not an option as it forces me to use pixels instead of percentage for the spaces on the sides.

Return to “Issues”