2

I have a jquery slider on my page which is centered when the page is wide enough to fit it yet aligns with the left edge of the window and shifts when the window is smaller. Below is my CSS - Am I missing something?

#billboardWrapper {height:600px;width:100%;margin:-170px 0 0 0px; position:relative; overflow:hidden; /*border-width: 0 20px 20px 20px; border-style:solid; border-color: {{settings.billboard_color}}; /* can't use border shorthand. IE9 has a rendering bug, see more notes in the ie8.css file */ }

#billboard {height:600px;width:1000px;position:relative;/*background:#1c1c1c;*/ background-position: 50% 0pt;}

#billboardPrev,
#billboardNext { display:block; text-indent:-9999px; position:absolute; left:40px; top:270px; width:30px; height:30px; cursor:pointer; background: url(arrows.png) no-repeat 0 0; z-index:99;}
#billboardNext {left:auto; right:40px; background-position:0 -92px; }

.slide {height:600px;width:1000px;display:none;  } 
.slide img {height:600px;  width:100%; background-position: 50% 0pt;  
.slideLeftLayout .slideTitle,.slideLeftLayout .slideText,.slideLeftLayout .slideLink {left:50px;}
.slideRightLayout .slideTitle,.slideRightLayout .slideText,.slideRightLayout .slideLink {right:50px;text-align:right;}
bikeechick
  • 65
  • 1
  • 7

1 Answers1

5

Perhaps it is centered by chance on the larger screen.

Centering usually works when you have:

width: (any-FIXED-WIDTH-value); - Good spot Bram Vanroy ;)
margin: auto;

which I cannot see...

You should really add your HTML too, and if possible start a jsfiddle and include the link. This way other users can play with it and solve it for you, and we can understand your code better too.

Hope that helps

Rick Donohoe
  • 7,081
  • 6
  • 26
  • 38
  • NOT any value! 'auto' will not centre the div. 'any fixed width' would be better. – Bram Vanroy May 22 '12 at 16:06
  • @rick donohue got it centered but ran into more problems keeping it ceneterd when the screen resolution is smaller. I posted a new and improved question here: http://stackoverflow.com/questions/10717424/centering-body-and-big-slider – bikeechick May 23 '12 at 10:38