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 8 of 8
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    zero space between DIV and top of page,,

    hey all

    how do you make a DIV square touch the top of the page,, so there is no empty space between the top edge of the DIV square and the top edge of the page??

    thanks in advance

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Add this in between your head tags
    Code:
    <style type="text/css">
    html, body {
    margin:0;
    padding:0;
    }
    </style>

  • #3
    Regular Coder
    Join Date
    May 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanx,,, actually i figured it out,,


    its suppose to be


    margin-top: -10px;

    thanx anyways

  • #4
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you put a 10px margin on your div by any chance?

  • #5
    Regular Coder
    Join Date
    May 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no i left it as default

    nut the browser keeps a 10 pix margin,,, so i had to put a (-10) margin to make zero lol

  • #6
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you have a link by any chance? Because what Aerospace said should work fine.

  • #7
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    -10 margins will not work on all browsers for each browser defines Their default HTML/BODY padding differently.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #8
    evo
    evo is offline
    waka Ionsurge
    Join Date
    Feb 2005
    Location
    United Kingdom
    Posts
    895
    Thanks
    5
    Thanked 12 Times in 12 Posts
    Just having margin: 0px on the body element will do that. You may mash up how it displays on non-ie browsers.


  •  

    Posting Permissions

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