I know this can be achieved with floats pretty easily, but I'm trying to move away from that practice. How might I achieve equal results using display: inline-block;
rather than floats?
Here is some code with inline-block
:
https://jsfiddle.net/hg7wx64k/
Here is some code with floats
:
https://jsfiddle.net/hg7wx64k/
#content-container {
width: 100%;
height: 100%;
text-align: center;
margin: 0 50px 0 50px;
}
#box1 {
display: inline-block;
height: 100%;
width: 30%;
background-color: orange;
}
#box2 {
display: inline-block;
height: 100%;
width: 30%;
background-color: blue;
}
#box3 {
display: inline-block;
height: 100%;
width: 30%;
background-color: yellow;
}
<div id="content-container" class="container">
<div id="box1">
<h1>Box 1</h1>
</div>
<div id="box2">
<h1>Box 2</h1>
</div>
<div id="box3">
<h1>Box 3</h1>
</div>
</div>
Here is a screenshot of the 3 boxes I'd like to have equal margins on both sides. I've thought of just manually setting the margins, but didn't know if this would be the cleanest solution. There's a lot I can do, but I'm trying to be more clean with my work. As well, this project I will not be using Bootstrap's grid system in so please no recommendations on that.
Just looking for what you guys would consider the most organized and functional method.