Why does this div shift down when content is added?

前端 未结 3 1163
时光说笑
时光说笑 2021-01-12 07:34

I have a 5x5 grid and when i add content to the div, it is shifted down. Can anyone explain why this is happening?

3条回答
  •  不要未来只要你来
    2021-01-12 08:19

    Setting overflow:hidden on the

    elements should fix it as it will make the elements ignore any margin or padding that inner-nodes create that overflow the containing element.

    Here is a demo: http://codepen.io/anon/pen/mDonw

提交回复
热议问题