html - Why Chrome doesn't respect the margin properly? -
i search long , can't find answer :/
in chrome (internet explorer, konqueror, , many others) h1 margin @ bottom added .blue. however, firefox respect css rules properly.
any suggestion?
html
<div class="red"><div class="blue"><h1>hello world!</h1></div></div> css
.red{ background: red; /* contain margins */ float:left; /* padding-top:1px; */ /* display: inline-block */ /* overflow: hidden */ } .blue{ background: blue; min-height: 60px; } h1{ margin: 10px 0 20px; background: green; } gecko-based: [this 1 correct, guess]

webkit-based, khtml-based , trident shell:

codepen
the margin issue having related min-height rule in .blue div. replace height rule if possible same result in chrome , firefox.
i have no idea why happening when using min-height though. maybe kind of chrome's bug.
Comments
Post a Comment