I want to lay out some divs in the arrangement I've diagrammed below. It's two squarish blocks side by side and then 2 half height blocks arranged vertically where a 3rd big block might have fit.
+---------+ +---------+ +---------+
| BOX1 | | BOX2 | | BOX3 |
| | | | +---------+
| | | | +---------+
| | | | | BOX4 |
+---------+ +---------+ +---------+
So far, the only way I've gotten close is to create 3 left floated boxes and put the two smaller boxes in the 3rd floated box. That doesn't feel right to me. Like, I'm adding extra divs just to control layout. Maybe that's OK but it doesn't feel right.
See it here:
https://jsfiddle.net/a84kv4wo/1/
.big_box {
height: 8em;
width: 8em;
border: 1px solid black;
float: left;
}
.small_box {
height: 4em;
width: 8em;
border: 1px solid black;
}
<div class="big_box">BOX1</div>
<div class="big_box">BOX2</div>
<div class="big_box">
<div class="small_box">BOX3</div>
<div class="small_box">BOX4</div>
</div>
For one thing, I might want to start applying more styles to the big box to control how the text is laid out and I don't want those styles to affect boxes 3 & 4.
It seems like the two big blocks should be left floated and then the two smaller boxes should just wrap around them, stacking vertically as divs tend to do. But that doesn't happen. I don't know what the answer is but it seems you should be able to just layout 4 divs and then arrange them how you want in CSS. Like in this fiddle:
https://jsfiddle.net/agfbrz5x/
.big_box {
height: 8em;
width: 8em;
border: 1px solid black;
float: left;
}
.small_box {
height: 4em;
width: 8em;
border: 1px solid black;
float: left;
}
<div class="big_box">BOX1</div>
<div class="big_box">BOX2</div>
<div class="small_box">BOX3</div>
<div class="small_box">BOX4</div>
That has the html I think I want but I can't get the css right.
Any ideas?