Skip to content

Instantly share code, notes, and snippets.

@enasellithy
Last active August 24, 2016 23:30
Show Gist options
  • Select an option

  • Save enasellithy/d26ece59f781aa3d245d208ddb48763e to your computer and use it in GitHub Desktop.

Select an option

Save enasellithy/d26ece59f781aa3d245d208ddb48763e to your computer and use it in GitHub Desktop.
Grid System & Image Class (de)
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
}
.upper, h1 {
text-transform: uppercase;
text-align: center;
}
.clear, .images {
clear: both;
}
h1 {
color: #F00;
font-size: 25px;
}
.de-1, .de-2, .de-3, .de-4, .de-5, .de-6, .de-7, .de-8, .de-9, .de-10, .de-11, .de-12 {
float: left;
padding: 10px;
background-color: #EEE;
border: 1px solid #AAA;
}
.de-1 {
width: 8.33333%;
}
.de-2 {
width: 16.66667%;
}
.de-3 {
width: 25%;
}
.de-4 {
width: 33.33333%;
}
.de-5 {
width: 41.66667%;
}
.de-6 {
width: 50%;
}
.de-7 {
width: 58.33333%;
}
.de-8 {
width: 66.66667%;
}
.de-9 {
width: 75%;
}
.de-10 {
width: 83.33333%;
}
.de-11 {
width: 91.66667%;
}
.de-12 {
width: 100%;
}
.image-de {
border-radius: 2px;
margin: auto;
padding: 20px;
}
.image-de-border {
border-radius: 50px;
margin: auto;
padding: 20px;
}
.image-de-circle {
border-radius: 100%;
margin: auto;
padding: 20px;
}
<div class="de-3">Test</div>
<div class="de-4">Test</div>
<div class="de-5">Test</div>
<div class="de-6">Test</div>
<div class="de-7">Test</div>
<div class="de-8">Test</div>
<div class="de-9">Test</div>
<div class="de-10">Test</div>
<div class="de-11">Test</div>
<div class="de-12">Test</div>
</div>
<div class="images">
<img class="image-de" src="http://www.freedigitalphotos.net/images/previews/duckling-10087357.jpg">
<img class="image-de-border" src="http://www.freedigitalphotos.net/images/previews/duckling-10087357.jpg">
<img class="image-de-circle" src="http://www.freedigitalphotos.net/images/previews/duckling-10087357.jpg">
</div>
$mainColor: #F00;
$fontSize: 20px;
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
}
.upper {
text-transform: uppercase;
text-align: center;
}
.clear {
clear: both;
}
h1 {
@extend .upper;
color: $mainColor;
font-size: $fontSize + 5;
}
$denum: 12;
%de {
float: left;
padding: 10px;
background-color: #EEE;
border: 1px solid #AAA;
}
@for $i from 1 through 12 {
.de-#{$i} {
width: (100% / ($denum / $i));
@extend %de;
}
}
.images {
@extend .clear;
}
$image-map: (image-de: 2px, image-de-border: 50px, image-de-circle: 100%);
@each $key, $val in $image-map {
.#{$key} {
border-radius: $val;
margin: auto;
padding: 20px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment