Forums

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

Home Forums CSS margin, padding issue

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31048
    cybershot
    Participant

    I never really understood the padding, margin issue when adding either for top or bottom. I have a box, I want to push it down 280 pixels from the top of the wrapper, but instead it pushes the wrapper that distance from the top of the browser. What is the best method to keep the wrapper in place and push the box down from the top?

    #69421
    daredanger
    Participant

    I think you are using

    position: absolute;

    . Try after removing this line.

    #69425
    clokey2k
    Participant

    I have encountered the same problem before. Recreated here: http://jsbin.com/itaqi4/2/

    The top margin of the ‘h1’ appears to be pushing the wrapper down. The only way I found to fix it is to put content before the first element, but within the wrapper. See: http://jsbin.com/itaqi4/3/

    The alternate is just to add padding to the first element – but I’m not sure of the possible side effects.

    #69365
    Anonymous
    Inactive

    “you could add a 1px top padding to the wrapper”

    That’s what I always do, works like a charm.

    #69297
    clokey2k
    Participant

    This is definitely something to add my knowledge toolbox. I have previously just avoided the situation.

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