I am attempting to create a grid layout of 4 divs arranged in a 2x2 configuration. I would like to have a 1 pixel border between these divs, similar to the following structure:
1|2
-+-
3|4
Each div should have equal size and collectively fill the entire screen regardless of resolution. Initially, I tried to create 2 rows with 2 column divs each, using the floating left property. While the rows work perfectly, adding the border between the divs causes a scroll bar to appear. It seems like the border is not being included in the 50% width. How can I resolve this issue?
Here is the code I have been working on:
CSS
html, body
{
margin: 0;
padding: 0;
width: 100%;
min-height: 100%;
}
.row
{
Width: 100%;
Height: 50%;
}
.border
{
border-bottom: 1px solid black;
}
HTML
<div class="row border" style="background-color: red;">
</div>
<div class="row" style="background-color: blue">
</div>
I also attempted to create a demo of the code in a fiddle: DEMO but the height: 100% on body and/or html does not seem to work as expected.