View Full Version : centered item(s) in 1024x768

12-09-2009, 12:27 AM

in a 1024x768 browser, the scrolling banner, which is wider than the browser constraints, is always centered.

how is this achieved?

is it possible to achieve this with HTML/CSS? or do i have to use JS or PHP or anything else?

the site i'm working on now is almost identical to the atlantis site, structure-wise. i'm using a scrolling banner built using jquery (wider than 1024x768), with a jquery animated dropdown menu at the top, and an additional navigation overlay. lots of position:relatives and position:absolutes... lots and lots of layers and z-indexes. everything is centered on the page, but when i minimize the browser, the widest item bumps up against the left of the window. i want the widest part (the scrolling banner) to be equally centered on the page.

any help is much appreciated, thanks!

12-09-2009, 02:30 PM
There are a number of scrolling items there. Are you talking about the main header banner with rotating images?

The centering for that rotating background image is done right here:
.headerbgcontainer {
margin:0 auto;

Seeing a link to your page might be more useful for diagnosing your issue though. Do you have a test link available?

12-09-2009, 04:36 PM
edited: oops i think i posted without making it in "reply" format, sorry.. see below

12-09-2009, 04:38 PM
thanks for the reply. unfortunately i don't have a test link i could post for you...

the margin:0 auto; is taken care of. the site is sitting in a centered wrapper, that's not the issue. it's that when the browser window is manually resized by the user to be smaller (width-wise) than the scrolling banner, the scrolling banner butts up against the left side of the browser window rather than remaining equally balanced.

if the user resizes the browser window to be, say, 1 inch wide, or 4 inches wide, i want the scrolling banner to be centered in it.

basically i need a way to center an item that goes offscreen in both directions.

12-09-2009, 09:59 PM
found the solution! posting for others to see:

found it here: http://www.wpdfd.com/editorial/thebox/deadcentre3.html

(#horizon acts as the wrapper, #content acts as the content div of course)

color: white;
background-color: #003;
margin: 0px

color: white;
background-color: transparent;
text-align: center;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 1px;
overflow: visible;
visibility: visible;
display: block

font-family: Verdana, Geneva, Arial, sans-serif;
background-color: transparent;
margin-left: -125px;
position: absolute;
top: -35px;
left: 50%;
width: 250px;
height: 70px;
visibility: visible

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum