Forums

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

Home Forums CSS How do you center div in CSS? Re: How do you center div in CSS?

#132213
CrocoDillon
Participant

In your first pen: http://codepen.io/ghafirsayed/pen/yJzfp

You could have given `#banner` it’s own block formatting context by setting `overflow: hidden;` or `display: inline-block;`, that would prevent margin-collapsing from `#banner_inner` to `#banner`. For future reference when setting padding on parent is not possible ;)