Varying number of div layout - css

I'm trying to generate a layout which has varying number of divs, I.e.
| Large | Large |
|Small | Small | Small |
| Large | Large |
...
Large divs will have 50% width, whereas smaller one's will have 33%.
How can I go about this? I'm floating the div's so that they're in a row, but unsure on how I can get three smaller divs, below the larger ones, whilst still ensuring everything is central?
Current approach:
.case-card--large {
width: 50%;
float: right;
}
.case-card {
float: right;
text-align: center;
padding: 40px;
width: 33%;
border: 1px solid blue;
}
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>

Here is my solution.
I have used display:inline-block for each box
* {
box-sizing: border-box;
}
.container {
font-size: 0; /* to remove space betwen inline elements*/
}
.wrapper {
font-size: initial;
}
.case-card {
text-align: center;
padding: 40px;
width: calc(100% / 3);
border: 1px solid blue;
display: inline-block;
}
.case-card--large {
width: 50%;
}
<div class="container">
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text Large</p>
</div>
</div>
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text Large</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text Large</p>
</div>
</div>
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text Large</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
</div>

You can work with a CSS technique: flex (MDN docs).
Put those elements in a parent container, set its width and make it behave as a flex-box by using display: flex. Here below is an example of how I did it. The CSS rules below the /* show case rules below */ are used to have a visual result of what you can have by using flex boxes.
#cont {
display: flex;
flex-direction: row;
width: 600px;
flex-wrap: wrap;
justify-content: space-between;
}
.case-card {
width: 33%;
box-sizing: border-box;
/* show case rules below */
background-color: red;
border: 1px solid black;
}
.case-card--large {
width: 50%;
/* show case rules below */
background-color: yellow;
}
<div id="cont">
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card case-card--large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
</div>
edit: I have used justify-content: space-around; first which aligns the elements with width: 33% somewhat nicely in the middle towards each other. Changing that to justify-content: space-between; ensures that the outer boxes are aligned to the same border as the container which may appeal the OP more. Credits for D.Schaller

You need to include box-sizing:border-box because you are using padding or to put width as width: calc(33% - 80px), also .large class create as subclass or otherwise in your case put !important, because now doesn't work and everything is width 33%
body{
text-align:center;
}
.case-card {
box-sizing: border-box;
display:inline-block;
text-align: center;
padding: 40px;
width: 33.33%;
border: 1px solid blue;
margin: 0 -2px;
}
.case-card.large{
width: 50%;
}
<div class="case-card large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>

Ok.. So I made little modification in the code and it works quite fine. Hope it helps you out.
Instead of float:right I used
float:left
and added the border to the wrapper class.
https://codepen.io/anon/pen/oMWMBE
.case-card--large {
width: 50%;
float: left;
text-align: center;
}
.wrapper { border: 1px solid blue; }
.case-card {
float: left;
text-align: center;
width: 33.33%;
}
<div class="case-card--large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card--large">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>
<div class="case-card">
<div class="wrapper">
<p>Dummy text</p>
</div>
</div>

Related

How to reverse boxes in a row below row with two boxes using flexbox?

I want to make a different boxes in a row: one - 33% width, second - 66% width. In a row below this I want to make same sized boxes but in reverse position like below on the picture:
Can't use every time new row with row-reverse style because client wants edit boxes in Wordpress using ACF Repeater, so it should be done only by CSS.
.row {
display: flex;
flex-wrap: wrap;
}
.box {
height: 100px;
margin-bottom: 10px;
}
.box:nth-child(even) {
flex: 0 0 66.666%;
max-width: 66.666%;
}
.box:nth-child(odd) {
flex: 0 0 33.333%;
max-width: 33.333%;
}
.box__item {
height: 100%;
border: 1px solid #000;
margin: 15px;
}
<div class='row'>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
</div>
You can do with nth-child()
.row {
display: flex;
flex-wrap: wrap;
}
.box {
height: 100px;
margin-bottom: 10px;
}
.box:nth-child(4n),
.box:nth-child(4n-3){
flex: 0 0 66.666%;
max-width: 66.666%;
}
.box:nth-child(4n-1),
.box:nth-child(4n-2){
flex: 0 0 33.333%;
max-width: 33.333%;
}
.box__item {
height: 100%;
border: 1px solid #000;
margin: 15px;
}
<div class='row'>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
<div class='box'>
<div class='box__item'> </div>
</div>
</div>

Foundation z-index for nested element

so I built my layout to the exact specifications but when I try to push the .feat section up (position: absolute; margin-top: -60px;) over the header element I run into z-index issues.
I've read many posts on setting the header element to position: relative; but that's not doing it.
a visual for you: the image should be over the white background
Here's my codePen with the exact setup.
I would really love to get this, thank you for your suggestions.
You can achieve this layout without using the absolute positioning for your different sections. Foundation offers XY Grid which can be used as demonstrated in the code examples/CodePen link below:
HTML
<div class="grid-container fluid">
<div class="grid-x header">
<div class="cell auto">
<h1>Coming to the Stage</h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<div class="cell medium-8">
<div class="grid-y h-100">
<div class="cell shrink">
<div class="grid-x grid-padding-x synopsis">
<div class="cell medium-4">
<p>Synopsis</p>
</div>
<div class="cell medium-8">
<p>Comedy powerhouse Jim Gaffigan has made a career out of finding the extraordinary </p>
</div>
</div>
</div>
<div class="cell medium-shrink">
<div class="grid-x grid-padding-x metainfo">
<div class="cell medium-4">
<p>Credits</p>
</div>
<div class="cell medium-8">
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<p>Talent</p>
</div>
<div class="cell medium-6">
<p>Jim Gaffigan</p>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<p>Directors</p>
</div>
<div class="cell medium-6">
<p>Aaron Feldman</p>
</div>
</div>
<div class="grid-x grid-padding-x">
<div class="cell medium-6">
<p>Producters</p>
</div>
<div class="cell medium-6">
<p>Jim Gaffigans</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cell medium-4">
<div class="grid-x grid-margin-x">
<div class="cell medium-10 feat">
<img src="http://www.comedydynamicsstaging.com/wp-content/uploads/2018/11/unnamed.jpg">
</div>
<div class="cell medium-2 pagination">
1 2 3
</div>
</div>
</div>
</div>
</div>
<div class="grid-container fluid">
<div class="grid-x">
<div class="cell medium-12 extra-meta">
Extra meta
</div>
</div>
</div>
CSS
body {
padding: 0;
margin: 0;
box-sizing: border-box;
background: green;
color: #fff;
text-align: center;
}
.header {
height: 285px;
background: grey;
text-align: left;
padding: 1rem;
}
.h-100 {
height: 100%;
}
.feat img {
margin-top: -60px;
}
.synopsis {
background: red;
height: 100%;
}
.pagination {
background: blue;
}
.metainfo {
background: orange;
height: 100%;
}
#media screen and (max-width: 640px) {
.metainfo {
margin-bottom: 60px;
}
}
.extra-meta {
background: pink;
margin-top: 1rem;
padding: 1rem;
}
CodePen example
Link to CodePen example here.

Full height div in Bootstrap 4 columns

I would like to have all my .element at the same height and the image vertical align middle if it's too small to be full size.
I tried so many things but I can't find the solution
.element {
border: 10px solid #e6e6e6;
margin-bottom: 20px;
}
.element .inner {
padding: 15px;
}
.element .inner p {
margin-bottom: 5px;
text-align: center;
}
.element a {
background-color: #424753;
color: #fff;
display: block;
height: 30px;
padding-top: 3px;
text-align: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.gimmesomeoven.com/wp-content/uploads/2015/08/How-To-Make-Crepes-5.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
</div>
You can add display: flex, flex-direction: column and flex: 1 on element, inner and col-3. To make img centered you can use margin-top and margin-bottom auto.
.col-3,
.element,
.inner {
display: flex;
flex-direction: column;
flex: 1;
}
.element {
border: 10px solid #e6e6e6;
margin-bottom: 20px;
}
.element .inner {
padding: 15px;
}
.element .inner p {
margin-bottom: 5px;
text-align: center;
}
.element a {
background-color: #424753;
color: #fff;
display: block;
height: 30px;
padding-top: 3px;
text-align: center;
}
.element img {
margin-top: auto;
margin-bottom: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.gimmesomeoven.com/wp-content/uploads/2015/08/How-To-Make-Crepes-5.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
</div>
You can use the new Bootstrap 4 flexbox utilities and reduce all the extra CSS..
http://www.codeply.com/go/LBkyWJzTrT
<div class="row">
<div class="col-3">
<div class="element d-flex h-100 flex-wrap justify-content-between">
<div class="inner d-flex flex-wrap align-self-center justify-content-center">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg">
<p>Some text</p>
</div>
<a href class="align-self-end w-100">Link</a>
</div>
</div>
<div class="col-3">
<div class="element d-flex h-100 flex-wrap justify-content-between">
<div class="inner d-flex flex-wrap align-self-center justify-content-center">
<img class="img-fluid" src="http://www.gimmesomeoven.com/wp-content/uploads/2015/08/How-To-Make-Crepes-5.jpg">
<p>Some text</p>
</div>
<a href class="align-self-end w-100">Link</a>
</div>
</div>
<div class="col-3">
<div class="element d-flex h-100 flex-wrap justify-content-between">
<div class="inner d-flex flex-wrap align-self-center justify-content-center">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg">
<p>Some text</p>
</div>
<a href class="align-self-end w-100">Link</a>
</div>
</div>
<div class="col-3 align-items-center">
<div class="element d-flex h-100 flex-wrap justify-content-between">
<div class="inner d-flex flex-wrap align-self-center justify-content-center">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg">
<p>Some text</p>
</div>
<a href class="align-self-end w-100">Link</a>
</div>
</div>
</div>
http://www.codeply.com/go/LBkyWJzTrT
Do you want like this, just added position styling. But with this you also have to write media-query styling.
.element {
border: 10px solid #e6e6e6;
margin-bottom: 20px;
height: 225px;
position: relative;
}
.element .inner {
padding: 15px;
}
.element .inner p {
margin-bottom: 5px;
text-align: center;
}
.element a {
background-color: #424753;
color: #fff;
display: block;
height: 30px;
padding-top: 3px;
text-align: center;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.gimmesomeoven.com/wp-content/uploads/2015/08/How-To-Make-Crepes-5.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
<div class="col-3">
<div class="element">
<div class="inner">
<img class="img-fluid" src="http://www.comohacercrepes.com//ImagenesComoHacerCrepes/ImagenesCrepes/receta-crepes-masa-thermomix.jpg" />
<p>Some text</p>
</div>
<a>Link</a>
</div>
</div>
</div>

Why do browser prefixes for text-align have different behaviour and which is correct?

I want to vertically centre <div> tags that have a horizontal margin between each other.
The problem is that this behavior appears to be inconsistent between text-align: center and text-align: -webkit-center or text-align: -moz-center:
.parent {
display: inline-block;
border: 1px dotted #fd0;
position: relative;
}
.parent.ta {
text-align: center;
}
.parent.browser-ta {
text-align: -webkit-center;
text-align: -moz-center;
}
.child {
display: inline-block;
vertical-align: top;
}
.child > .content {
display: block;
margin: 0 10px;
border: 1px solid #888;
width: 200px;
text-align: left;
}
.wrong {
background-color: #e00;
color: #fff;
}
.right {
background-color: #0a3;
color: #fff;
}
<div>
Using <tt>text-align: center</tt>;
<div class="parent ta">
<div class="child">
<div class="content wrong">child 1 LEFT</div>
<div class="parent ta">
<div class="child">
<div class="content">child a</div>
</div>
<div class="child">
<div class="content">child b</div>
</div>
<div class="child">
<div class="content">child c</div>
</div>
</div>
</div>
<div class="child">
<div class="content wrong">child 2 LEFT</div>
<div class="parent ta">
<div class="child">
<div class="content">child d</div>
</div>
<div class="child">
<div class="content">child e</div>
</div>
<div class="child">
<div class="content">child f</div>
</div>
</div>
</div>
<div class="child ">
<div class="content right">child 3 CENTRE</div>
</div>
</div>
</div>
<br>
<br>
<div>
Using <tt>text-align: -vendor-center</tt>
<div class="parent browser-ta">
<div class="child">
<div class="content right">child 1 CENTRE</div>
<div class="parent browser-ta">
<div class="child">
<div class="content">child a</div>
</div>
<div class="child">
<div class="content">child b</div>
</div>
<div class="child">
<div class="content">child c</div>
</div>
</div>
</div>
<div class="child">
<div class="content right">child 2 CENTRE</div>
<div class="parent browser-ta">
<div class="child">
<div class="content">child d</div>
</div>
<div class="child">
<div class="content">child e</div>
</div>
<div class="child">
<div class="content">child f</div>
</div>
</div>
</div>
<div class="child">
<div class="content right">child 3 CENTRE</div>
</div>
</div>
Run that snippet and the two similar HTML and CSS produce different layouts in Chrome (Webkit/Blink) and FireFox. The red panels are in the wrong location, the green ones are correct.
So text-align: -webkit-center and text-align: -moz-center appear to be correct (to me) but text-align: center appears to be bugged in both browsers.
Digging out the venerable old <centre> tag (that we're not supposed to use) and that works right too (though examining it reveals it uses the browser prefix too).
Is this correct? Is this a bug? Is there a reason for the difference? Which one should I use?
The prefixed values are described by MDN to be "block alignment values", which means block boxes themselves are aligned in addition to the inline content within them. This is the exact behavior of the <center> element, and the prefixed values are in fact intended for that element — if you look in the UA stylesheets for each engine you'll find a ruleset that says exactly center { display: block; text-align: -vendor-center; }.
The reason text-align: center is not implemented this way is because text-align is designed to affect inline-level boxes (as evidenced by the "text-" in its name), not block-level boxes. But that, I suspect, is not the answer you're really looking for.
What's happening is that the boxes that are actually being aligned in your snippet are the .content elements, which are block boxes, not inline-blocks. The reason that last element is being centred is because its parent, an inline-block, is being shrink-wrapped, and itself then centred by the text-align: center declaration in its ancestor.

Center Div scroll

In my code,
Within one container Three blocks will be there. one freezes on the left and one freezes on the right and the other will scroll in between these two divs. Just like modern grids. But I don't want to use the grid.
I have tried, but the center block is not getting the Horizontal scroll.
I want no breakage of the center block, instead, it should scroll horizontally.
* {
box-sizing: border-box;
}
.container {
width: 100%;
overflow: auto;
white-space: nowrap
}
.scroll-center {
width: auto;
overflow: auto;
display: block;
white-space: nowrap
}
.row {
float: left;
}
.cell {
padding: 3px;
border: 1px solid #bbb;
min-height: 25px;
min-width: 200px;
}
<div class="container">
<div class="row">
<div class="cell">HeaderL1</div>
<div class="cell">HeaderL2</div>
<div class="cell">HeaderL3</div>
</div>
<div class="scroll-center">
<div class="row">
<div class="cell">HeaderT2</div>
<div class="cell">Data21</div>
<div class="cell">Data22</div>
</div>
<div class="row">
<div class="cell">HeaderT3</div>
<div class="cell">Data31</div>
<div class="cell">Data32</div>
</div>
<div class="row">
<div class="cell">HeaderT4</div>
<div class="cell">Data41</div>
<div class="cell">Data42</div>
</div>
<div class="row">
<div class="cell">HeaderT5</div>
<div class="cell">Data51</div>
<div class="cell">Data52</div>
</div>
<div class="row">
<div class="cell">HeaderT6</div>
<div class="cell">Data61</div>
<div class="cell">Data62</div>
</div>
<div class="row">
<div class="cell">HeaderT7</div>
<div class="cell">Data71</div>
<div class="cell">Data72</div>
</div>
<div class="row">
<div class="cell">HeaderT8</div>
<div class="cell">Data81</div>
<div class="cell">Data82</div>
</div>
<div class="row">
<div class="cell">HeaderT9</div>
<div class="cell">Data91</div>
<div class="cell">Data92</div>
</div>
</div>
<div class="right">
<div class="row">
<div class="cell">HeaderTR</div>
<div class="cell">DataR1</div>
<div class="cell">DataR2</div>
</div>
</div>
</div>
You probably need to add width to your container. Right now it's set to 100% so it will not size beyond the browser window. Instead you could do something like this:
.container {
overflow: auto;
white-space: nowrap;
width:2000px;
}
I realize that you may need to change this value dynamically but hopefully this gets you started
Example:http://codepen.io/nilestanner/pen/jAjbdK
Try with For example:
css:
* {
box-sizing: border-box;
}
.left, .center, .right{
float:left
}
.center {
width:400px;
overflow: scroll;
display: block;
white-space: nowrap
}
#center-scroll{
width:2000px;
}
.center .row{
display:inline-block;
width:33%;
}
.center .row .cell{
min-width:100%;
}
.row{
float:left;
}
.cell {
padding: 3px;
border: 1px solid #bbb;
min-height: 25px;
min-width: 200px;
}
HTML
<div class="container">
<div class="left">
<div class="row" >
<div class="cell">HeaderL1</div>
<div class="cell">HeaderL2</div>
<div class="cell">HeaderL3</div>
</div>
</div>
<div class="center">
<div id="center-scroll">
<div class="row">
<div class="cell">HeaderT2</div>
<div class="cell">Data21</div>
<div class="cell">Data22</div>
</div>
<div class="row">
<div class="cell">HeaderT3</div>
<div class="cell">Data31</div>
<div class="cell">Data32</div>
</div>
<div class="row">
<div class="cell">HeaderT4</div>
<div class="cell">Data41</div>
<div class="cell">Data42</div>
</div>
<div class="row">
<div class="cell">HeaderT5</div>
<div class="cell">Data51</div>
<div class="cell">Data52</div>
</div>
<div class="row">
<div class="cell">HeaderT6</div>
<div class="cell">Data61</div>
<div class="cell">Data62</div>
</div>
<div class="row">
<div class="cell">HeaderT7</div>
<div class="cell">Data71</div>
<div class="cell">Data72</div>
</div>
<div class="row">
<div class="cell">HeaderT8</div>
<div class="cell">Data81</div>
<div class="cell">Data82</div>
</div>
<div class="row">
<div class="cell">HeaderT9</div>
<div class="cell">Data91</div>
<div class="cell">Data92</div>
</div>
</div>
</div>
<div class="right">
<div class="row">
<div class="cell">HeaderTR</div>
<div class="cell">DataR1</div>
<div class="cell">DataR2</div>
</div>
</div>
</div>

Resources