I can't seem to center a div
horizontally inside another div
. Here's my html:
.block {
padding: 0px 20px;
max-width: 820px;
margin: 0 auto;
background-color: #ff0;
}
.container {
margin: 0 auto;
display: inline-block;
background-color: red;
padding: 5px;
}
<div class="block">
<div class="container">
<button>£10</button>
<button>£20</button>
<button>£30</button>
</div>
</div>
It looks like this:
I want the red div
centered inside the yellow div
. At the moment it is aligned left.
Here's the codepen: https://codepen.io/carlrippon/pen/MWwaORv?editors=1111
I don't need to support old versions of IE - just IE11