JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>CSS Fluid Grid</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
padding:50px;
}
.container {
background:#ccc;
}
.box {
background:#333;
margin-bottom:2%;
}
.box-green {
background:green;
}
</style>
</head>
<body>
<h1>Columns</h1>
<div class="container">
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="one column box"> - </div>
<div class="ten columns box"> - </div>
<div class="five columns box"> - </div>
<div class="five columns box"> - </div>
<div class="ten columns box">
<div class="nested">
<div class="five columns box-green"> - </div>
<div class="five columns box-green"> - </div>
</div>
</div>
<div class="five columns box">
<div class="nested">
<div class="five columns box-green"> - </div>
<div class="five columns box-green"> - </div>
</div>
</div>
<div class="five columns box">
-
</div>
</div>
<hr>
<h1>Gallery example</h1>
<div class="container">
<div class="one column box"> - </div>
<div class="one column box"> - </div>
...
CSS
.container {
width:100%;
margin: 0 auto;
clear: both;
*zoom: 1;
}
.container:after {
content:".";
clear:both;
display:block;
height:0;
visibility:hidden;
}
.column, .columns {
float: left;
display: inline;
margin-left: 1%;
margin-right: 1%;
overflow-x:hidden;
}
.zero { width: 3%; }
.one { width: 8%; }
.two { width: 18%; }
.three { width: 28%; }
.four { width: 38%; }
.five { width: 48%; }
.six { width: 58%; }
.seven { width: 68%; }
.eight { width: 78%; }
.nine { width: 88%; }
.ten { width: 98%; }
.nested {
width:102%;
margin-left:-1%;
}