Skip to content

Instantly share code, notes, and snippets.

@jgraffin
Last active August 29, 2015 14:20
Show Gist options
  • Save jgraffin/026b73429b852d747c7c to your computer and use it in GitHub Desktop.
Save jgraffin/026b73429b852d747c7c to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<!DOCTYPE html>
<html>
<head>
<title>Boxes</title>
</head>
<link href="css/styles.css" rel="stylesheet" />
<body>
<div id="wrapper">
<div class="content">
<div class="boxGreen">
Eu sou <strong class="destaque">verde</strong>
</div>
<div class="boxYellow">
Eu sou <strong class="destaque">amarelo</strong>
</div>
<div class="boxRed">
Eu sou <strong class="destaque">vermelho</strong>
</div>
<div class="boxBlue">
Eu sou <strong class="destaque">azul</strong>
</div>
<div class="boxGrey">
Eu sou <strong class="destaque">cinza</strong>
</div>
<div class="boxPurple">
Eu sou <strong class="destaque">roxo</strong>
</div>
</div>
</div>
</body>
</html>
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
body{
border: 0px;
padding: 0px;
margin: 0px;
}
#wrapper {
width: 960px;
margin: 0 auto;
}
.content {
float:left;
width: 100%;
text-align: center;
}
// =================== Define a estrutura básica
%size-box {
margin: 5px;
width: 20%;
height: 200px;
display: inline-block;
line-height: 10em;
color: #ffffff;
font:{
family: arial, sans-serif;
style: italic;
size: 16px;
}
}
// =================== Aplica estilo para o destaque
.destaque {
padding: 4px 6px;
border-radius: 4px;
text-transform: uppercase;
}
// =================== Define com um argumento o que deverá ser mudado no elemento
@mixin style-box($colors){
@extend %size-box;
background: $colors;
strong {
background: lighten($colors, 30%);
color: $colors;
}
}
// =================== Monta um array de cores
$map-boxes: (
Green : #27ae60,
Yellow : #f1c40f,
Red : #e74c3c,
Blue : #3498db,
Grey : #95a5a6,
Purple : #9b59b6
) !default;
// =================== Itera o array e aplica em cada elemento a cor com base na classe
@each $type, $colors in $map-boxes {
.box#{$type}{
@include style-box($colors);
}
}
body {
border: 0px;
padding: 0px;
margin: 0px;
}
#wrapper {
width: 960px;
margin: 0 auto;
}
.content {
float: left;
width: 100%;
text-align: center;
}
.boxGreen, .boxYellow, .boxRed, .boxBlue, .boxGrey, .boxPurple {
margin: 5px;
width: 20%;
height: 200px;
display: inline-block;
line-height: 10em;
color: #ffffff;
font-family: arial, sans-serif;
font-style: italic;
font-size: 16px;
}
.destaque {
padding: 4px 6px;
border-radius: 4px;
text-transform: uppercase;
}
.boxGreen {
background: #27ae60;
}
.boxGreen strong {
background: #89e5b0;
color: #27ae60;
}
.boxYellow {
background: #f1c40f;
}
.boxYellow strong {
background: #f9e8a0;
color: #f1c40f;
}
.boxRed {
background: #e74c3c;
}
.boxRed strong {
background: #f8c9c4;
color: #e74c3c;
}
.boxBlue {
background: #3498db;
}
.boxBlue strong {
background: #b6daf2;
color: #3498db;
}
.boxGrey {
background: #95a5a6;
}
.boxGrey strong {
background: #e8ecec;
color: #95a5a6;
}
.boxPurple {
background: #9b59b6;
}
.boxPurple strong {
background: #dbc3e5;
color: #9b59b6;
}
<!DOCTYPE html>
<html>
<head>
<title>Boxes</title>
</head>
<link href="css/styles.css" rel="stylesheet" />
<body>
<div id="wrapper">
<div class="content">
<div class="boxGreen">
Eu sou <strong class="destaque">verde</strong>
</div>
<div class="boxYellow">
Eu sou <strong class="destaque">amarelo</strong>
</div>
<div class="boxRed">
Eu sou <strong class="destaque">vermelho</strong>
</div>
<div class="boxBlue">
Eu sou <strong class="destaque">azul</strong>
</div>
<div class="boxGrey">
Eu sou <strong class="destaque">cinza</strong>
</div>
<div class="boxPurple">
Eu sou <strong class="destaque">roxo</strong>
</div>
</div>
</div>
</body>
</html>
@jgraffin
Copy link
Author

jgraffin commented May 6, 2015

Compilando com Sass! Aehooooo!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment