Skip to content

Instantly share code, notes, and snippets.

@danielres
Created February 20, 2012 18:32
Show Gist options
  • Save danielres/1870545 to your computer and use it in GitHub Desktop.
Save danielres/1870545 to your computer and use it in GitHub Desktop.
advanced compass usage with blueprint grid & scaffolding, and color theory
/* resulting css after compilation */
html {
margin: 0;
padding: 0;
border: 0; }
.bp-reset-element, body, h1, h2, h3, h4, h5, h6, article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, blockquote, q, th, td, caption, table,
div, span, object, iframe, p,
pre, a, abbr, acronym, address,
code, del, dfn, em, img,
dl, dt, dd, ol, ul, li, fieldset,
form, label, legend,
caption, tbody, tfoot, thead, tr {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline; }
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
display: block; }
blockquote, q {
quotes: "" ""; }
blockquote:before, blockquote:after, q:before, q:after {
content: ""; }
th, td, caption {
float: none !important;
text-align: left;
font-weight: normal;
vertical-align: middle; }
table {
border-collapse: separate;
border-spacing: 0;
vertical-align: middle; }
a img {
border: none; }
body {
line-height: 1.5;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
color: #333333;
font-size: 75%; }
body h1, body h2, body h3, body h4, body h5, body h6 {
font-weight: normal;
color: #222222; }
body h1 img, body h2 img, body h3 img, body h4 img, body h5 img, body h6 img {
margin: 0; }
body h1 {
font-size: 3em;
line-height: 1;
margin-bottom: 0.50em; }
body h2 {
font-size: 2em;
margin-bottom: 0.75em; }
body h3 {
font-size: 1.5em;
line-height: 1;
margin-bottom: 1.00em; }
body h4 {
font-size: 1.2em;
line-height: 1.25;
margin-bottom: 1.25em; }
body h5 {
font-size: 1em;
font-weight: bold;
margin-bottom: 1.50em; }
body h6 {
font-size: 1em;
font-weight: bold; }
body p {
margin: 0 0 1.5em; }
body p .left {
display: inline;
float: left;
margin: 1.5em 1.5em 1.5em 0;
padding: 0; }
body p .right {
display: inline;
float: right;
margin: 1.5em 0 1.5em 1.5em;
padding: 0; }
body a {
text-decoration: underline;
color: #0066cc; }
body a:visited {
color: #004c99; }
body a:focus {
color: #0099ff; }
body a:hover {
color: #0099ff; }
body a:active {
color: #bf00ff; }
body blockquote {
margin: 1.5em;
color: #666666;
font-style: italic; }
body strong, body dfn {
font-weight: bold; }
body em, body dfn {
font-style: italic; }
body sup, body sub {
line-height: 0; }
body abbr, body acronym {
border-bottom: 1px dotted #666666; }
body address {
margin: 0 0 1.5em;
font-style: italic; }
body del {
color: #666666; }
body pre {
margin: 1.5em 0;
white-space: pre; }
body pre, body code, body tt {
font: 1em "andale mono", "lucida console", monospace;
line-height: 1.5; }
body li ul, body li ol {
margin: 0; }
body ul, body ol {
margin: 0 1.5em 1.5em 0;
padding-left: 1.5em; }
body ul {
list-style-type: disc; }
body ol {
list-style-type: decimal; }
body dl {
margin: 0 0 1.5em 0; }
body dl dt {
font-weight: bold; }
body dd {
margin-left: 1.5em; }
body table {
margin-bottom: 1.4em;
width: 100%; }
body th {
font-weight: bold; }
body thead th {
background: #c3d9ff; }
body th, body td, body caption {
padding: 4px 10px 4px 5px; }
body table.striped tr:nth-child(even) td,
body table tr.even td {
background: #e5ecf9; }
body tfoot {
font-style: italic; }
body caption {
background: #eeeeee; }
body .quiet {
color: #666666; }
body .loud {
color: #111111; }
form label {
font-weight: bold; }
form fieldset {
padding: 1.4em;
margin: 0 0 1.5em 0; }
form legend {
font-weight: bold;
font-size: 1.2em; }
form input.text, form input.title, form input[type=email], form input[type=text], form input[type=password] {
margin: 0.5em 0;
background-color: white;
padding: 5px; }
form input.title {
font-size: 1.5em; }
form textarea {
margin: 0.5em 0;
padding: 5px; }
form select {
margin: 0.5em 0; }
form fieldset {
border: 1px solid #cccccc; }
form input.text, form input.title, form input[type=email], form input[type=text], form input[type=password],
form textarea {
background-color: #fff;
border: 1px solid #bbbbbb; }
form input.text:focus, form input.title:focus, form input[type=email]:focus, form input[type=text]:focus, form input[type=password]:focus,
form textarea:focus {
border-color: #666666; }
form select {
background-color: #fff;
border-width: 1px;
border-style: solid; }
form input.text, form input.title, form input[type=email], form input[type=text], form input[type=password] {
width: 300px; }
form textarea {
width: 390px;
height: 250px; }
form .box {
padding: 1.5em;
margin-bottom: 1.5em;
background: #e5ecf9; }
form .border {
padding-right: 4px;
margin-right: 5px;
border-right: 1px solid #dddddd; }
form .colborder {
padding-right: 24px;
margin-right: 25px;
border-right: 1px solid #dddddd; }
form hr {
background: #dddddd;
color: #dddddd;
clear: both;
float: none;
width: 100%;
height: 0.1em;
margin: 0 0 1.45em;
border: none; }
form hr.space {
background: #dddddd;
color: #dddddd;
clear: both;
float: none;
width: 100%;
height: 0.1em;
margin: 0 0 1.45em;
border: none;
background: white;
color: white;
visibility: hidden; }
form form.inline {
line-height: 3; }
form form.inline p {
margin-bottom: 0; }
body #page_container {
width: 950px;
margin: 0 auto;
overflow: hidden;
*zoom: 1;
overflow: visible; }
body header, body footer {
display: inline;
float: left;
margin-right: 10px;
width: 950px; }
* html body header, * html body footer {
overflow-x: hidden; }
body #body_content_right {
display: inline;
float: left;
margin-right: 10px;
width: 270px;
display: inline;
float: right;
margin-right: 0; }
* html body #body_content_right {
overflow-x: hidden; }
body #body_content_left {
display: inline;
float: left;
margin-right: 0;
width: 630px; }
* html body #body_content_left {
overflow-x: hidden; }
form label {
display: inline;
float: left;
margin-right: 10px;
width: 150px; }
* html form label {
overflow-x: hidden; }
form .actions {
margin-left: 160px; }
nav#menu {
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
*zoom: 1; }
nav#menu li {
list-style-image: none;
list-style-type: none;
margin-left: 0;
white-space: nowrap;
display: inline;
float: left;
padding-left: 4px;
padding-right: 4px; }
nav#menu li:first-child, nav#menu li.first {
padding-left: 0; }
nav#menu li:last-child {
padding-right: 0; }
nav#menu li.last {
padding-right: 0; }
.border-radius, #page, body h1, body p, body nav#menu, body nav#menu li, body #body_content_right .inner {
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
-ms-border-radius: 20px;
-o-border-radius: 20px;
border-radius: 20px; }
.single-box-shadow, body h1, body p, body nav#menu, body nav#menu li, body #body_content_right .inner {
-webkit-box-shadow: -5px 3px 15px rgba(0, 0, 0, 0.25);
-moz-box-shadow: -5px 3px 15px rgba(0, 0, 0, 0.25);
box-shadow: -5px 3px 15px rgba(0, 0, 0, 0.25); }
.padded, body h1, body p, body nav#menu, body nav#menu li, body #body_content_right .inner {
padding: 20px; }
.stackable, body h1, body p, body nav#menu, body nav#menu li, body #body_content_right .inner {
margin-bottom: 20px; }
#page {
background: #b5a18f; }
body {
background: #6b4420;
padding: 20px 0;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #442b14), color-stop(100%, #6b4420));
background-image: -webkit-linear-gradient(#442b14, #6b4420);
background-image: -moz-linear-gradient(#442b14, #6b4420);
background-image: -o-linear-gradient(#442b14, #6b4420);
background-image: -ms-linear-gradient(#442b14, #6b4420);
background-image: linear-gradient(#442b14, #6b4420); }
body h1 {
border: 5px solid #793812;
background-color: #a54d19;
color: #44200a; }
body p {
border: 5px solid #794e12;
background-color: #a56b19;
color: #442c0a; }
body nav#menu {
border: 5px solid #122279;
background-color: #192fa5;
color: #0a1344; }
body nav#menu li {
border: 5px solid #126c79;
background-color: #1993a5;
color: #0a3d44;
padding: 5px;
border: 0;
margin-right: 10px; }
body #body_content_right .inner {
border: 5px solid #124979;
background-color: #1963a5;
color: #0a2944; }
// INIT ========================================================================
@import compass
@import blueprint
@import blueprint/reset
@import blueprint/scaffolding
body
+blueprint-typography(true)
// +blueprint-utilities
// +blueprint-debug
// +blueprint-interaction
form
+blueprint-form
+blueprint-scaffolding
// STRUCTURE / LAYOUT / BOX-MODEL ==============================================
$blueprint-grid-columns: 24
$blueprint-container-size: 950px
$blueprint-grid-margin: 10px
$blueprint-grid-width: ($blueprint-container-size + $blueprint-grid-margin) / $blueprint-grid-columns - $blueprint-grid-margin
$blueprint-cell-width: $blueprint-grid-width + $blueprint-grid-margin
=container-alt
+container
overflow: visible
body
#page_container
+container-alt
header, footer
+column($blueprint-grid-columns)
#body_content_right
$sidebar-columns: floor($blueprint-grid-columns / 3) - 1
+column($sidebar-columns)
+float(right)
+last
#body_content_left
$content-columns: ceil(2 * $blueprint-grid-columns / 3)
+column($content-columns, true)
form
label
+column(4)
.actions
margin-left: span(4) + 10px
nav#menu
+horizontal-list
// THEMING / DECORATIONS =======================================================
// VARIABLES & DEFAULTS -----------------------------------
$default-box-shadow-color: fade-out(black, 0.75)
$default-box-shadow-blur: 15px
$default-box-shadow-h-offset: -5px
$default-box-shadow-v-offset: 3px
$delta: 10deg
$base_color: adjust_hue(#a55c19, 0deg)
$analog1: adjust_hue($base_color, $delta)
$analog2: adjust_hue($base_color, -$delta)
$complement: adjust_hue($base_color, 180deg)
$complement_analog1: adjust_hue($complement, $delta)
$complement_analog2: adjust_hue($complement, -$delta)
$page_background: darken(desaturate($base_color, 20%), 10%)
$default_border_width: 5px
$default_border_style: solid
$default_border_color: gray
$default_border_radius: 20px
// MIXINS & CLASSES ---------------------------------------
=bordered($border_width: $default_border_width, $border_style: $default_border_style, $border_color: $default_border_color)
border: $border_width $border_style $border_color
=stackable
margin-bottom: 20px
=padded
padding: 20px
=rounded
+border-radius
.border-radius
+border-radius
.single-box-shadow
+single-box-shadow
.padded
+padded
.stackable
+stackable
=auto_block($block_background)
$bg: hsl( hue(mix($block_background, $page_background)), saturation($block_background), lightness($block_background) )
+bordered($border_color: darken($bg, 10%))
$contrasted-dark-default: mix( darken($bg, 20%), black, 90% )
$contrasted-light-default: mix( lighten($bg, 20%), white, 90% )
+contrasted($bg)
@extend .padded
@extend .single-box-shadow
@extend .border-radius
@extend .stackable
// LET'S APPLY THE THEMING ! ------------------------------
#page
background: mix($page_background, white)
@extend .border-radius
body
background: $page_background
padding: 20px 0
+linear-gradient($page_background, darken($page_background, 10%))
h1
+auto_block($analog2)
p
+auto_block($analog1)
nav#menu
+auto_block($complement_analog1)
li
+auto_block($complement_analog2)
padding: 5px
border: 0
margin-right: 10px
#body_content_right
.inner
+auto_block($complement)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment