Aaron Aaron - 7 months ago 23
HTML Question

Image Centering Issue Inside Parent Div Element

I used JavaScript to create a slideshow on the homepage of my site. The problem I'm having is that the image will not center to the page, despite my best efforts. I can get it centered if I set the image child element like so:

#slider img {
left: 218px;}

but that doesn't center for different window sizes. I'm using fairly large images, but they can always be resized later. I used placeholders for the fiddle. How can you fix this?



U can easily center image by set up:

#slider img {
  display: block;
  margin: 0 auto;
  width: 100%; // or your own width