I have seen multiple questions and answers on here about fluid grids with fixed gutters. I have also seen a lot about equal-height fluid-width div columns. I am trying to do both at the same time and have found no concrete solution.
I was able to make it work, but my solution seems a little 'hacky' and unstable. Below is my markup with jsFiddle link. Is this a safe way to accomplish equal-height fluid-width divs with fixed gutters, or do you recommend a better solution? I have been trying to improve on my semantics and writing robust code lately...
**Browser Support only requires IE9+
HTML
<div class="grid">
<div class="grid_01">
<h2>Change Password</h2>
<p>Individual locations may only update their own password. The master location may update all passwords.</p>
<p>If you have any questions, please contact the us at 555-555-5555.</p>
</div>
<div class="gutter"></div>
<div class="grid_01">
<h2>New Password</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit.</p>
</div>
</div>
CSS
.grid {display:table; padding:20px;}
.grid_01 {
display:table-cell;
width:50%;
padding:20px;
border-top:4px solid #a085c6;
background:#ffffff;
-moz-box-shadow:0px 1px 1px 0px #717171;
-webkit-box-shadow:0px 1px 1px 0px #717171;
box-shadow:0px 1px 1px 0px #717171;
}
.gutter {width:20px;}
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
My biggest concern is the empty gutter div. I appreciate any constructive feedback.
You can do this with flexbox. Set your grid items to have a
margin-right: 20px
(or whatever you want your gutter to be), then set the last-child grid item margin-right to 0.See the fiddle: http://jsfiddle.net/xLR3x/