Using display: table
Here's an option that doesn't use calc, but you'll need to use an additional element that you'll hide and show depending on the screen size: Demo
Add another class to your top sidebar item:
<div class="right_sidebar_top one">Lorem ipsum</div>
Then replace your bottom sidebar item with this:
<div class="right_sidebar">
<div class="right_sidebar_top two">Lorem ipsum</div>
<div class="right_sidebar_bottom">Lorem ipsum</div>
</div>
Then use this css outside the media-queries. It hides the top sidebar item and displays the sidebar grouping. Using display: table-cell
allows the one div to be a set width, and the content to expand:
.content_wrapper, .right_sidebar {
display: table-cell;
vertical-align: top;
}
.right_sidebar_top.one {
display: none;
}
.right_sidebar_top.two{
display: block;
}
Then in your 599px media-query, hide the top sidebar within the grouping and display the single top sidebar item and set everything else back to display: block
to act like divs:
.content_wrapper, .right_sidebar {
display: block;
}
.right_sidebar_top.one {
display: block;
}
.right_sidebar_top.two {
display: none;
}
Using calc()
If you can use calc()
, this is an option: Demo
This allows the divs to flow exactly how you'd like. May need to make some minor tweaks to get it exactly how you want.
.content_wrapper {
width: calc(100% - 250px); // keeps the right side at 250px for the right sidebar
background-color: #ffff90;
float: left; // allows the two right column divs to float next to it
}
//to clear floats
#minmax:after {
display: table;
content:'';
clear: both;
}
.right_sidebar_bottom {
float: right;
}
@media-query(max-width: 599px){
.content_wrapper {
width: 100%;
}
}