.outline-1 { outline: darkred 2px dashed; }
.outline-2 { outline: aqua 2px dashed; }
.outline-3 { outline: blue 2px dashed; }
body { margin: 0; padding: 50px;}
.wrap { margin: 0; padding: 0; background-color: white;}
.one, .two {
margin-left: -15px;
margin-right: -15px;
}
.oneone, .twotwo {
display: block;
}
.no-margin {
margin-left: 0;
margin-right: 0;
}
.block-text:before {
display: block;
content: '[block]';
}
.inline-text:before {
display: inline;
content: '[inline]'
}
<div class="wrap outline-1">
<span class="one outline-2">
<div class="oneone">aaa bbb</div>
</span>
<span class="two outline-3">
<div class="twotwo">bbb aaa</div>
</span>
</div>
Why non-zero margin (left of right) causes a line-break before span.one starts? The line-break disappears when you apply .no-margin to span.one or span.two.
I guess it's the child div that causes the line-break, but cannot know why it happens only if both left- or right-margin is non-zero.
+
The line-break disappears when you apply .no-margin to span.one or span.two. ← This is the topic of this question. I know how line-break appears, but not how line-break disappears
This is not duplicate of this question. That does not explain why the zero-margin removes line-break.