Why exactly are inline and inline-block elements unable to calculate their own width based on the rendered text/content inside, which as I understand it is why margin:auto won't work on them?
What's the design reason behind this spec implementation? I don't really understand why this behavior is needed, it seems like it would be much more logical if at least inline-block would be able to.
Example:
https://jsfiddle.net/0w9cxn1m/2/
CSS
.area {
background-color:pink;
display:block-flow;
padding:1em;}
p {background-color:red; color:white;}
.inline{display:inline; margin-top:3em; margin-left:3em;}
.inline-block{display:inline-block; margin-top:0em; margin-left:auto;}
.inline-block-3em{display:inline-block; margin-top:0em; margin-left:3em; margin-top:0em;}
.block-centered {display:block; width:300px; margin:0 auto;}
HTML
<div class="area">
<p class="inline">Inline element margin 3em</p>
<p class="inline-block">
Inline-Block with margin-left:auto
</p>
<p class="inline-block-3em">
Inline-Block with margin-left:3em
</p>
<p class="block-centered">
300px wide p block element centered by auto margin calculation
</p>
</div>