Great job! You're almost there. One thing to consider is setting the flex: 0 0 <basis>
property on the columns to prevent them from expanding or shrinking, with the <basis>
value determining their width.
Another option is to use the CSS3 calc()
function to set the column's height
relative to the header height.
#productShowcaseTitle {
flex: 0 0 100%; /* Fill the space horizontally */
height: 100px;
}
#productShowcaseDetail,
#productShowcaseThumbnailContainer{
height: calc(100% - 100px); /* Adjust for header height */
}
#productShowcaseContainer {
display: flex;
flex-flow: row wrap;
height: 600px;
width: 580px;
}
#productShowcaseTitle {
flex: 0 0 100%;
height: 100px;
background-color: silver;
}
#productShowcaseDetail {
flex: 0 0 66%;
height: calc(100% - 100px);
background-color: lightgray;
}
#productShowcaseThumbnailContainer {
flex: 0 0 34%;
height: calc(100% - 100px);
background-color: black;
}
<div id="productShowcaseContainer">
<div id="productShowcaseTitle"></div>
<div id="productShowcaseDetail"></div>
<div id="productShowcaseThumbnailContainer"></div>
</div>
(Vendor prefixes omitted due to brevity)
If you prefer an alternative approach, consider wrapping the columns in an extra <div>
element:
<div class="contentContainer"> <!-- Additional wrapper -->
<div id="productShowcaseDetail"></div>
<div id="productShowcaseThumbnailContainer"></div>
</div>
#productShowcaseContainer {
display: flex;
flex-direction: column;
height: 600px;
width: 580px;
}
.contentContainer {
display: flex;
flex: 1;
}
#productShowcaseDetail {
flex: 3;
}
#productShowcaseThumbnailContainer {
flex: 2;
}
#productShowcaseContainer {
display: flex;
flex-direction: column;
height: 600px;
width: 580px;
}
.contentContainer {
display: flex;
flex: 1;
}
#productShowcaseTitle {
height: 100px;
background-color: silver;
}
#productShowcaseDetail {
flex: 3;
background-color: lightgray;
}
#productShowcaseThumbnailContainer {
flex: 2;
background-color: black;
}
<div id="productShowcaseContainer">
<div id="productShowcaseTitle"></div>
<div class="contentContainer"> <!-- Additional wrapper -->
<div id="productShowcaseDetail"></div>
<div id="productShowcaseThumbnailContainer"></div>
</div>
</div>
(Vendor prefixes omitted due to brevity)