I want to make my div elements be centered in the same line. I want it to be done without using a fixed margin because that doesn't work as soon as you resize it or change screen resolution.
I've tried using "margin: 0 auto" but that didn't seem to work. I've also trid a couple of different things but they were honestly all just me kicking in the dark.
The HTML:
<div class="container div3">
<div class="sredina">
<div class="box">
<img>
<h3></h3>
<p></p>
</div>
<div class="box">
<img>
<h3></h3>
<p></p>
</div>
<div class="box">
<img>
<h3></h3>
<p></p>
</div>
</div>
The CSS:
.box{
text-align: center;
width: 20%;
border: 2px solid blue;
margin: 1pt;
float: left;}
.div3{
text-align: center;}
.sredina{
display: inline-block;
margin: auto;
border: 2px solid red;}
.container{
width: 80%;
margin: auto;
overflow: hidden;
}
How it looks now: An image of how it looks now
How I want it to look: An image of how it should look