SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict blizzman24's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    css creates a space between the content and header...

    My site it aligned like this:

    header
    content
    footer
    (unique I know )

    anyways, theres always a space between the site and the top of the screen. How do I get my content to start at the very top of the screen?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    Massachussetts, US
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can we see the code or at least a link?
    Make sure the header's bottom and content's top margins are set to 0.
    Alternatively if that fails, use negative margines, ie:

    Code:
    margin-top: -1em;
    Good luck

  3. #3
    SitePoint Enthusiast Mikeymoo's Avatar
    Join Date
    Jul 2003
    Location
    St. Albans, Uk
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just to follow on from there, saying nothing and setting a margin to zero are not the same.

    If you do not set a setting, browsers will set themselve to the default value, which vary from browser to browser. To get around this, I always set the margins and padding to zero in the body tag.

    Then I can add whatever I need from there.
    Mikel
    Good decisions come from experience.
    Experience comes from making bad decisions.

  4. #4
    SitePoint Addict blizzman24's Avatar
    Join Date
    Jul 2004
    Location
    Texas
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    TY it worked!

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Alternatively if that fails, use negative margines, ie:
    Note that normally there should be no need for negative margins unless you actually mean to drag something back over something else (or perhaps some obscure browser bug is rearing its ugly head . (Also note that ie like to have a position:relative on some elements that have negative margins otherwise it doesn't show them at all.)

    Most of the times it will be a conflict of margins or just the default margins applied to certain elements that varies from browser to browser as mikel pointed out.

    Remember that the largest margin on an element is the one that gets applied. Therefore if you set the top element to have a bottom margin of zero it still won't butt up against the element below unless the element below has had its top margin set to zero also.

    Just thought it worth mentioning even though the problem's been sorted

    Paul


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
  •