I'm attempting to center a block element horizontally on my webpage.
Here's an illustration of what I'm aiming for:
I can't use fixed div dimensions as the design needs to be responsive.
Click here for the demo.
Below is the HTML code:
<div class = "container">
<div class="sub">
<h1> 01</h1>
<div class = "icon"><img src="img/settings.png" alt="">
<h2> Power Inside</h2>
<p>Cum sociis natoque penatibus et magnis dis parturient montesmus. Pro vel nibh et elit mollis commodo et nec augueique</p>
<a class="iconlink" href="/">Read more</a>
</div>
</div>
<div>
CSS
.container {
width: 1160px;
overflow: hidden;
display: inline-flex;
margin: 0 auto;
}
.sub{
padding: 30px;
display: inline-block;
vertical-align: top;
}
....
....