SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot ShinoKage's Avatar
    Join Date
    Apr 2010
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Backgrounds to the Edge of the Browser....

    I'm sure this probably has an answer somewhere findable, but I have no clue how to search for it.

    Most sites have backgrounds that extend to the edge of the browser without any white space between the element(s) and the browser edge/chrome. It's usually with footers (that I've noticed anyways). I can't figure out how to do it without absolute positioning.

    Help please!
    Thanks :3

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's normally the default padding or margin on the body element.

    Code CSS:
    html, body {
      margin:0;
      padding:0;
    }
    Birnam wood is come to Dunsinane

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,107
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Hi ShinoKage, welcome to SitePoint!

    Browsers apply default margins and paddings to various element, so you have to remove these if you don't want them.

    If you add this to your style sheet, it will remove them:

    Code:
    * {margin:0; padding:0;}
    However, it's better not to do that, as it has consequences. The better approach is to remove margins/paddings from specific elements as you add them.

    In your case, it sounds like you need

    Code:
    body {margin:0;}
    Hope that helps!
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  4. #4
    SitePoint Zealot ShinoKage's Avatar
    Join Date
    Apr 2010
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, well, there we go. I knew about that someplace in the back of my brain x.X Guess I forgot about it with all my book-learning (in the middle of Everything you Know About CSS is Wrong!).

    But thank you! Much appreciated <3


Tags for this Thread

Bookmarks

Posting Permissions

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