I have a div
with the style display: inline-block
- this is used to make the div automatically expand to it's content.
The div
won't center using margin: 0 auto;
. To troubleshoot this, I changed the element's style to display: block
and width: 100px
and it does center.
How am I able to center the div
element which uses display: inline-block
?
ul {
list-style: none;
margin: 0px;
padding: 0px;
}
<div style="margin: 0 auto; display: inline-block;">
<ul>
<li>Example</li>
<li>Example</li>
<li>Example</li>
</ul>
</div>
JsFiddle: https://jsfiddle.net/8xz0sze6/2/