Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS body background moving?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41889
    kloy
    Member

    What’s going on here?
    When I put a 50 px margin on the top, the body background also moves, leaving an empty gray area.

    http://www.palettedesign.com/

    #120490
    jaze
    Member

    set background img to “fixed”…

    background: url(“library/images/arches.png”) repeat fixed 0 0;

    #120510
    wolfcry911
    Participant

    @kloy, what you’re seeing is correct rendering. The top margin on the content ‘extends’ out of the top of the body (or parent element). There are a number of ways to correct this.
    1) Add a 1px padding to the top of body, or
    2) Add a 1px border to the top of body, or
    3) Add overflow: hidden; to body (changing its block formatting context), or
    4) Use 50px top padding on the body and remove the top margin from the content (as Eric stated)
    5) Place the background image on an ancestor element, html in this case (as jurotek stated).

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.