Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    1
    Member #
    37973

    confused about wrapper div

    Hiieeee dear friends. I am new to webdesigning and learning how to use html divs and css layout techniques to layout webpages.I am having a problem about outer wrapper divs that is used extensively by many web designers. What I want to do is that make a layout with a top header, a banner, main content area and then a footer. I want to fit all the contents of these sections that I have mentioned to be contained by a outer wrapper which is 960 px wide. But at the same time I want to make the background of the header and the footer take the full width of the browser. The problem is when I put the header and footer inside the 960px wide wrapper I am not able to make the header and footer backgrounds extend beyond 960px. So guys how do I achieve this layout by keeping the contents of the header,banner,content and footer inside the same 960 px outer wrapper and at the same time make the backgrounds of header and footer extend beyond 960 pixels. pleeez pleeez pleeez help me out guys.

    This is my html code for the desired layout :

    <div id="wrapper">

    <div id="header">
    header content...
    </div>

    <div id="banner">
    banner content...
    </div>

    <div id="content">
    main content...
    </div>

    <div id="footer">
    footer content...
    </div>

    </div>

    and this is the css :


    #wrapper {
    width:960px;
    margin:0 auto;
    }

    #header {
    background:#06C;
    }

    #banner {
    background:#0C9;
    }

    #content {
    background:#666666;
    }

    #footer {
    background:#993333;
    }

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    quite simple... you don't...

    for your purposes... without making some major usless code hacks it's not necessary... the purpose of the wrapper is to keep everything inside the same width, since that is not what you want, then don't use it... wrap the content area... let the header and footer go 100% width...

    why 960 width ? on a wide screen monitor @1600 wide, that is gonna leave a 250+ wide area on each side of the content... basically wasting 1/3 of your usable screen space...

    I suggest using % widths if you want to have areas on each side but you can maximize usable space and fit more screens and look the same across them all...

    the 960 grid was something that went out a long time ago

  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Actually, you can, but not with one single wrapper.

    For what you want to do in particular, each of your header, content and footer divs should contain a .wrapper class, not be contained by a wrapper id. By doing that, they'll adapt to whatever width you desire and then from there the .wrapper can add your auto margins and 960px padding.

    I've given you the concept. It's up to you to figure out how to apply it.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:35 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com