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 6 of 6
  1. #1
    New Coder
    Join Date
    Jul 2007
    Location
    Portland, OR
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What is a wrapper for?

    I have seen wrapper divs but I still don't understand what they are for?

    What is the purpose of a wrapper?

  • #2
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    It is the section you wrap everything in. Behind the wrapper is the body, so if you for example set a background color to the body, it will show, except in the #wrapper.
    .
    .

  • #3
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Quote Originally Posted by vinoman View Post
    I have seen wrapper divs but I still don't understand what they are for?

    What is the purpose of a wrapper?
    Using a div as a wrapper (or #container, or #content, or #whatever) just adds one more style hook. It makes it easy to do things like center a fixed-width website, or define a solid width to fit columns in. I use "#wrapper" all the time, but like all style hooks it's up to you whether or not you need to use it.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,877
    Thanks
    6
    Thanked 1,035 Times in 1,008 Posts
    I’ve always used a wrapping div because I thought the body wasn’t as easy to style as a div. However, recently I noticed that a wrapper wouldn’t be mandatory for regular websites as the body can be styled like a regular div in recent browsers (don’t know about IE5/NS6). I’ve done this on this website I’m currently developing. I used the html and body elements to apply background colors and images (still used a #container div due to many background images and general styling). I see a problem in Netscape 7, though, in that the html won’t take a background image.

  • #5
    New Coder
    Join Date
    Jul 2007
    Location
    Portland, OR
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Jutlander View Post
    It is the section you wrap everything in. Behind the wrapper is the body, so if you for example set a background color to the body, it will show, except in the #wrapper.
    If everything is in the wrapper, how would you see any background color?

  • #6
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    Because it doesn't necessarily have to fill out all space. You could center a site with it or you could leave a 10 px margin on all sides, if that's what you want. Try it out and you'll see for yourself.
    .
    .


  •  

    Posting Permissions

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