I have a page divided into sidebar and content with flex display where sidebar has 0.15 flex and content 0.85. This page should be full width of viewport.
My problem is when i try to add a table into page content, I want to have a table to fit the parent div, in our case it is content and have horizontall scroll bar if the table doesn't fit.
Currently, the table makes content just stretch horizontally and that is not what i wanted. I want to be able resize window for example down and the table should shrink as well.
Please check js fiddle for example:
http://jsfiddle.net/kopwmsuq/7/
My code looks like this:
.page {
width: 100%;
height: 100%;
display: flex;
}
.sidebar {
flex: 0.15;
background-color: red;
}
.content {
flex: 0.85;
background-color: blue;
display: flex;
flex-direction: column;
text-align: center;
}
.step-content {
flex: 1;
}
.step-footer {
display: block;
}
table {
display: block;
overflow-x: auto;
white-space: nowrap;
}
button {
display: block;
}
<div class="page">
<div class="sidebar">
// sidebar buttons
</div>
<div class="content">
<div class="step-content">
whatever
<div>
<table>
// BIG TABLE THAT STRETCHS WHOLE PAGE CONTENT
</table>
</div>
</div>
<div class="step-footer">
</div>
</div>
</div>