- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
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?
I think you are using
position: absolute;
. Try after removing this line.
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.
“you could add a 1px top padding to the wrapper”
That’s what I always do, works like a charm.
This is definitely something to add my knowledge toolbox. I have previously just avoided the situation.