Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2008
    Location
    MD, USA
    Posts
    65
    Thanks
    16
    Thanked 0 Times in 0 Posts

    centered item(s) in 1024x768

    http://www.atlantis.com/default.aspx

    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!

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    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:
    Code:
    .headerbgcontainer {
    margin:0 auto;
    overflow:hidden;
    position:relative;
    text-align:center;
    z-index:2;
    }
    Seeing a link to your page might be more useful for diagnosing your issue though. Do you have a test link available?
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #3
    New Coder
    Join Date
    Jul 2008
    Location
    MD, USA
    Posts
    65
    Thanks
    16
    Thanked 0 Times in 0 Posts
    edited: oops i think i posted without making it in "reply" format, sorry.. see below
    Last edited by mssteph; 12-09-2009 at 03:39 PM.

  • #4
    New Coder
    Join Date
    Jul 2008
    Location
    MD, USA
    Posts
    65
    Thanks
    16
    Thanked 0 Times in 0 Posts
    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.
    Last edited by mssteph; 12-09-2009 at 05:07 PM.

  • #5
    New Coder
    Join Date
    Jul 2008
    Location
    MD, USA
    Posts
    65
    Thanks
    16
    Thanked 0 Times in 0 Posts
    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)

    Code:
    body 
    	{
    	color: white;
    	background-color: #003;
    	margin: 0px
    	}
    
    #horizon        
    	{
    	color: white;
    	background-color: transparent;
    	text-align: center;
    	position: absolute;
    	top: 50%;
    	left: 0px;
    	width: 100%;
    	height: 1px;
    	overflow: visible;
    	visibility: visible;
    	display: block
    	}
    
    #content    
    	{
    	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
    	}


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •