Minimal grid system with media query
by makzan
HTML
<header class='row'>
<div class='four col'>
<h1><img src='http://placehold.it/50x50' />Big Title Here</h1>
</div>
</header>
<div class='row'>
<nav class='four col'>
<ul>
<li><a href='#'>Link Here</a></li>
<li><a href='#'>Link Here</a></li>
<li><a href='#'>Link Here</a></li>
<li><a href='#'>Link Here</a></li>
<li><a href='#'>Link Here</a></li>
<li><a href='#'>Link Here</a></li>
</ul>
</nav>
</div>
<div class='row'>
<div class='three col'>
<p>3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text 3 col text </p>
<div class='row'>
<div class='one col'>Login</div>
<div class='three col'>
<input type='text'>
<input type='text'></input>
<input type='submit' value='Login'>
</div>
</div>
</div>
<div class='one col'>
<p>1 col</p>
<p>1 col</p>
<p>1 col</p>
<p>1 col</p>
</div>
</div>
<footer class='row'>
<div class='four col'>
footer here
</div>
</footer>
CSS
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
html, body {
font-size: 14px;
}
p {
text-align: justify;
}
input[type="text"] {
width: 100%;
}
.row {
width: 500px;
max-width: 100%;
border: 1px solid blue;
margin: 0 auto;
overflow: auto;
}
.row .row {
width: 100%;
margin-left: -10px;
}
.col {
padding: 0 10px;
border: 1px solid red;
float:left;
}
.one {
width: 25%;
}
.two {
width: 50%;
}
.three {
width: 75%;
}
.four {
width: 100%;
}
header h1 {
margin: 0;
padding: 0;
font-size: 2em;
}
header h1 img {
vertical-align: middle;
margin-right: 5px;
}
nav ul {
list-style: none;
padding: 0;
}
nav ul li {
float: left;
border: 1px solid green;
}
nav ul li a {
text-decoration: none;
color: blue;
padding: 2px;
display: inline-block;
}
@media all and (max-width: 380px) {
.col {
width: 100%;
}
.row .row {
margin: auto;
}
.row .row .col {
padding: 0;
}
input {
width: 100%;
}
header h1 {
text-align: center;
font-size: 1em;
}
header h1 img {
display: block;
margin: 0 auto;
}
nav ul li{
width: 50%;
}
}