leroy merlin
standard grid preview
by Grzegorz Matyszewski
HTML
<header class="header"><h1>Leroy Merlin</h1></header>
<main class="content">
<div class="grid">
<ul>
<li class="column"></li><!--
--><li class="column"></li><!--
--><li class="column"></li><!--
--><li class="column"></li><!--
--><li class="column"></li><!--
--><li class="column"></li><!--
--><li class="column"></li><!--
--><li class="column"></li>
</ul>
<ul>
<li class="column--left" title="product photo"></li><!--
--><li class="column--middle" title="product description"></li><!--
--><li class="column--right" title="product rightbar"></li>
</ul>
<ul>
<li class="column--quarter"></li><!--
--><li class="column--quarter"></li><!--
--><li class="column--quarter"></li><!--
--><li class="column--quarter"></li>
</ul>
<ul>
<li class="column--half"></li><!--
--><li class="column--half"></li>
</ul>
</div>
</main>
SCSS
/* Leroy Merlin - grid preview
===============================
Note: this is not working prototype of grid elements,
just visualisation how columns should
be displayed in different window sizes.
[email protected]
*/
// variables:
$column-width: 200px;
$column-gap: 40px;
$left-margin: 60px;
$right-margin: 60px;
$left-shift: -$column-gap;
$right-shift: $column-gap*0.5;
// functions:
@function getWidth($count){
@return $count*$column-width + (-1+$count)*$column-gap;
}
@function getBreakpoint($count){
@return getWidth($count) + $left-margin + $right-margin;
}
// mixins:
@mixin breakpoint($count) {
$bp: getBreakpoint($count);
@media (min-width: $bp){
@content;
}
}
/* ====================== *
* MAIN STYLES
* ======================= */
body {
text-align: center;
font-family: sans-serif;
font-size: 12px;
background: white;
overflow: hidden; //jsfiddle mediaqueries bug
&:before, &:after {
border-color: red;
border-width: 0 30px 0 30px;
border-style: solid;
background: white;
width: 1px;
position: fixed;
top: 0;
bottom: 0;
left: -1px;
opacity: 0.05;
z-index: 1;
content: '';
}
&:after {
right: -1px;
left: auto;
}
}
.header {
width: 100%;
height: 80px;
display: block;
padding: 10px 30px;
box-sizing: border-box;
h1 {
text-align: left;
border-bottom: 1px solid black;
line-height: 50px;
font-weight: 600;
&:after {
@for $i from 2 through 8 {
$wdt: getWidth($i);
$bp: getBreakpoint($i);
@media (min-width: $bp){
content: " (min-wdth: #{$bp})";
}
}
}
}
}
.content {
display: block;
position: relative;
overflow: hidden;
padding: 0 $right-margin 0 $left-margin;
}
.grid {
position: relative;
margin: auto;
outline: 1px dotted red; // for test purposes only
white-space: nowrap;
overflow: hidden;
max-width: 100%;
@for $i from 3 through 8 {
$wdt: getWidth($i);
...