Forums

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

Home Forums CSS Margin to 0 on first and last element in wrapper Re: Margin to 0 on first and last element in wrapper

#55677
steveooo
Member

#box is the content wrapper with e.g. a white background whereas the body background is e.g. light blue. So with two different backgrounds you will see the padding of the #box, so your (and my first thought) alternative isn’t suitable for that way.

I am looking for an alternative where you don’t change the padding (of #box) for replacing the function of

#box>:first-child { margin-top : 0 }
#box>:last-child { margin-bottom : 0 }