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

Thread: Width problem

  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Width problem

    Hi,
    I have the following css:

    Code:

    Code:
    #container { background: url(../images/page.gif) repeat-y center;
    position:relative;
    width:100%;
    height:100%;
    }
    #banner {background:url(../images/banner.gif) no-repeat center;
    height:108px;
    width:100%;
    position:relative;
    }
    #menu {background:url(../images/menu.gif) no-repeat  top center;
    height:124px;
    width:100%;
    position:relative;
    }
    #content {
    	margin-left: 240px;
    	font-family:'Helv', Arial, Helvetica, Geneva, sans-serif;
    	font-size:14px;
    	letter-spacing:1px;
    	color:#000;
    	text-align:justify;
    	width:580px;
    	position:relative;
    }
    #footer {background:url(../images/pgfooter.gif) bottom center no-repeat;
    
    height:46px;
    width:100%;
    position:relative;
    }

    all background images are fixed width for 1024x768

    and i have the following html
    <div id="container">
    <div id="banner"></div>
    <div id="menu"></div>
    <div id="content"> All text goes here </div>
    <div id="footer"></div>
    </div>

    now the problem is that if i set the #container width to let say 1000px; it works fine (only resizing the browser instantly i have the horizontal scroller). So i want to set thethe container width to 100%. As soon as i set that and resize the browser the page flows well But the text in the #content div remains static and doesn't move along with the backgrounds, thus flowing "out" of the text area.

    the links is here
    Code:
    Code:
    http://ocdmonline.org/michael/
    username: ocdmonline pass:4yGx3fM
    Any ideas?
    10x

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello Azriel,
    I'm not sure what you gain by having your #container 100% wide. Have you tried just centering it like this?

    Code:
    body {
    width:100%;
    	background:#008eb1;
    	}
    #container { 
    background: url(http://ocdmonline.org/michael//images/page.gif) repeat-y center;
    position:relative;
    width:1024px;
    height:100%;
    margin: 0 auto;
    }
    #banner {background:url(http://ocdmonline.org/michael//images/banner.gif) no-repeat center;
    height:108px;
    width:100%;
    position:relative;
    }
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello Excavator,

    yeah i tried that , and it is a possible solution but the difference is that with the 100% when the browser is scaled down horizontally, the banner and the rest of the page remain centred (and no horizontal scrollbar until i reach the text area) whilst if i use the pixel size then immediately the horizontal scroll bar comes up and it reduces from right to left.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Your image http://ocdmonline.org/michael/images/page.gif is not symmetric. Correct is and then set a width say, width:616px; to #contents. After that set margin: 0 auto; to centre it horizontally.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok that worked perfectly 10x


  •  

    Posting Permissions

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