0

I've just spent quite some time chasing a gap like the one in this plunk. The problem wasn't that simple. It's a dynamically created page and some component having margin-bottom happened to be displayed last inside of .main.

Before I blame CSS, I wonder, what's the proper way for styling such an (old-school) bordered design? I mean something what doesn't break when an unknown component gets put inside?

maaartinus
  • 44,714
  • 32
  • 161
  • 320

2 Answers2

1

Adding overflow:auto; to your main class is a simple one-line fix.

See - Margin-Top push outer div down

Community
  • 1
  • 1
RichardB
  • 2,615
  • 1
  • 11
  • 14
  • I was googling before and I'd never come to the idea that it's margin collapsing. Chromium just shows a gap with no reason at all. – maaartinus Jul 01 '14 at 00:54
0

You can add !importantin your css,when you get unknown margin or padding,like

.tagclass{
    margin:0!important;
    padding:0!important;
}

It will raise the priority of margin:0 and padding:0,clear the gap.

meeming
  • 88
  • 13