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 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2007
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to make divs fill browser?

    I am trying to make a top bar div of a different color that stretches over the whole browser. However, just creating the div keeps a small border around the top and sides of the div. Is there any way to extend the div so those gaps aren't there?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Give width and height as 100%, but this will be the 100% of its container.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    924
    Thanks
    10
    Thanked 56 Times in 55 Posts
    Without seeing your cde, it is difficult to say for certain what might be happening, but use the 'star' selector hack and set the margins and padding to zero for the html element and those spaces should (maybe) go away.
    Code:
    * html {
    margin:0;
    padding:0;
    }
    Try it and let us know it that works.

    Also, eliminate all the margins and padding for the <hx> elements in that div...

  • #4
    New Coder
    Join Date
    Sep 2007
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oooh yeah setting the margin of the body to 0 seems to work! thanks!


  •  

    Posting Permissions

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