From dfbaaca2a51630c780d80f3b4e7a75fd2af8fc24 Mon Sep 17 00:00:00 2001 From: Raphael Goetter Date: Sun, 20 Apr 2014 20:34:39 +0200 Subject: [PATCH] booleans variables added --- css/01-base.css | 125 +------------------ css/06-rwd.css | 12 -- css/09-booleans.css | 141 +++++++++++++++++++++ less/00-config.less | 33 +++-- less/01-base.less | 279 ++++++++++++------------------------------ less/06-rwd.less | 6 - less/09-booleans.less | 147 ++++++++++++++++++++++ less/knacss.less | 1 + 8 files changed, 394 insertions(+), 350 deletions(-) create mode 100644 css/09-booleans.css create mode 100644 less/09-booleans.less diff --git a/css/01-base.css b/css/01-base.css index 168a2bd..b68f0de 100644 --- a/css/01-base.css +++ b/css/01-base.css @@ -141,47 +141,12 @@ kbd { font-family: Consolas, 'DejaVu Sans Mono', Courier, monospace; line-height: normal; } -code, -kbd, -mark { - border-radius: 2px; -} em { font-style: italic; } strong { font-weight: bold; } -kbd { - padding: 0 2px; - border: 1px solid #999; -} -code { - padding: 2px 4px; - background: rgba(0, 0, 0, 0.04); - color: #b11; -} -pre code { - padding: none; - background: none; - color: inherit; - border-radius: 0; -} -mark { - padding: 2px 4px; - background: #ff0; -} -sup, -sub { - vertical-align: 0; - position: relative; -} -sup { - bottom: 1ex; -} -sub { - top: .5ex; -} /* ----------------------------- */ /* == hiding content */ /* ----------------------------- */ @@ -196,23 +161,6 @@ sub { width: 1px; } /* ----------------------------- */ -/* == skip links styling */ -/* ----------------------------- */ -.skip-links { - position: absolute; -} -.skip-links a { - position: absolute; - left: -7000px; - padding: 0.5em; - background: black; - color: white; - text-decoration: none; -} -.skip-links a:focus { - position: static; -} -/* ----------------------------- */ /* == browsers consistency */ /* ----------------------------- */ /* avoid top margins on first content element */ @@ -346,10 +294,6 @@ img.end { .txtcenter { text-align: center; } -/* ----------------------------- */ -/* == width helpers */ -/* .. use only when needed */ -/* ----------------------------- */ /* blocks widths (percentage and pixels) */ .w10 { width: 10%; @@ -438,16 +382,11 @@ img.end { .wauto { width: auto; } -/* ----------------------------- */ -/* == spacing helpers */ -/* .. use only when needed */ -/* ----------------------------- */ /* spacing helpers -p,m = padding,margin -a,t,r,b,l = all,top,right,bottom,left -s,m,l,n = small(10px),medium(20px),large(30px),none(0) -source https://github.com/stubbornella/oocss/blob/master/core/spacing/space.css -*/ + p,m = padding,margin + a,t,r,b,l = all,top,right,bottom,left + s,m,l,n = small, medium, large, none + */ .m-reset, .ma0 { margin: 0; @@ -609,62 +548,6 @@ source https://github.com/stubbornella/oocss/blob/master/core/spacing/space.css padding-left: 4em; } /* ----------------------------- */ -/* == iefix */ -/* ----------------------------- */ -/* Make sure you are using Conditional Classes in your HTML */ -/* see : http://www.alsacreations.com/astuce/lire/988-classes-conditionnelles-HTML.html */ -.ie678 h1, -.ie678 .h1-like { - font-size: 2.28571429em; -} -.ie678 h2, -.ie678 .h2-like { - font-size: 2em; -} -.ie678 h3, -.ie678 .h3-like { - font-size: 1.71428571em; -} -.ie678 h4, -.ie678 .h4-like { - font-size: 1.42857143em; -} -.ie678 h5, -.ie678 .h5-like { - font-size: 1.28571429em; -} -.ie678 h6, -.ie678 .h6-like { - font-size: 1.14285714em; -} -/* hasLayout for IE6/IE7 */ -.ie67 .clearfix, -.ie67 .line, -.ie67 .mod, -.ie67 .row, -.ie67 .col { - zoom: 1; -} -/* inline-block and table-cell for IE6/IE7 */ -/* warning: .col needs width on IE6/IE7 */ -.ie67 .btn, -.ie67 .col, -.ie67 .inbl { - display: inline; - zoom: 1; -} -.ie8 img { - width: auto; - /* @bugfix for IE8 */ -} -/* Active box-sizing for IE6/IE7 */ -/* @source https://github.com/Schepp/box-sizing-polyfill */ -/* -.ie67 * { - behavior: url(/lib/box-sizing-polyfill/boxsizing.htc); -} -*/ -/* ----------------------------- */ /* == quick print reset */ /* ----------------------------- */ @media print { diff --git a/css/06-rwd.css b/css/06-rwd.css index ccaf3c1..2ba05e3 100644 --- a/css/06-rwd.css +++ b/css/06-rwd.css @@ -100,18 +100,6 @@ display: table-cell !important; vertical-align: top !important; } - /* you shall not pass */ - div, - textarea, - table, - td, - th, - code, - pre, - samp { - word-wrap: break-word; - hyphens: auto; - } /* widths for small screens */ .small-w25 { width: 25% !important; diff --git a/css/09-booleans.css b/css/09-booleans.css new file mode 100644 index 0000000..31e0635 --- /dev/null +++ b/css/09-booleans.css @@ -0,0 +1,141 @@ +code, +kbd, +mark { + border-radius: 2px; +} +kbd { + padding: 0 2px; + border: 1px solid #999; +} +code { + padding: 2px 4px; + background: rgba(0, 0, 0, 0.04); + color: #b11; +} +pre code { + padding: none; + background: none; + color: inherit; + border-radius: 0; +} +mark { + padding: 2px 4px; + background: #ff0; +} +sup, +sub { + vertical-align: 0; + position: relative; +} +sup { + bottom: 1ex; +} +sub { + top: .5ex; +} +blockquote { + margin-left: 0; + padding-left: 1em; + border-left: 4px solid rgba(0, 0, 0, 0.15); + font-style: italic; +} +q { + font-style: normal; +} +q, +.q { + quotes: "“\00a0" "\00a0”"; +} +q:lang(fr), +.q:lang(fr) { + quotes: "«\00a0" "\00a0»"; +} +hr { + display: block; + clear: both; + height: 1px; + margin: 1em 0 2em; + padding: 0; + border: 0; + color: #ccc; + background-color: #ccc; +} +.ie678 h1, +.ie678 .h1-like { + font-size: 2.28571429em; +} +.ie678 h2, +.ie678 .h2-like { + font-size: 2em; +} +.ie678 h3, +.ie678 .h3-like { + font-size: 1.71428571em; +} +.ie678 h4, +.ie678 .h4-like { + font-size: 1.42857143em; +} +.ie678 h5, +.ie678 .h5-like { + font-size: 1.28571429em; +} +.ie678 h6, +.ie678 .h6-like { + font-size: 1.14285714em; +} +.ie678 img { + width: auto; + /* @bugfix for IE8 */ +} +/* hasLayout for IE6/IE7 */ +.clearfix, +.line, +.mod, +.row, +.col { + *zoom: 1; +} +/* inline-block and table-cell for IE6/IE7 */ +/* warning: .col needs width on IE6/IE7 */ +.btn, +.col, +.inbl { + *display: inline; + *zoom: 1; +} +/* Active box-sizing for IE6/IE7 */ +/* @source https://github.com/Schepp/box-sizing-polyfill */ +/* + .ie67 * { + behavior: url(/lib/box-sizing-polyfill/boxsizing.htc); + } + */ +.skip-links { + position: absolute; +} +.skip-links a { + position: absolute; + left: -7000px; + padding: 0.5em; + background: black; + color: white; + text-decoration: none; +} +.skip-links a:focus { + position: static; +} +@media (max-width: 480px) { + /* you shall not pass */ + div, + textarea, + table, + td, + th, + code, + pre, + samp { + word-wrap: break-word; + hyphens: auto; + } +} diff --git a/less/00-config.less b/less/00-config.less index dcef006..4a44177 100644 --- a/less/00-config.less +++ b/less/00-config.less @@ -1,19 +1,28 @@ // Config file : variables, mixins, ... + +// booleans +@ie678 : true; // "true" to activate IE6/IE7/IE8 support +@styling : true; // "true" to design basic elements like code, mark, blockquotes, etc. +@skip-links : true; // "true" to design skip links for accessibility concerns +@hyphens : true; // activate automatic hyphens on small screens +@helpers-width : true; // decide whether or not you need width helpers +@helpers-spacing : true; // decide whether or not you need spacing helpers + // font sizes -@basefont : 14px; // if "14px" then 1em = 14px -@lh : 1.5; // equiv line-height 1.5em -@h1-size : 32px; // equiv "32px" -@h2-size : 28px; // equiv "28px" -@h3-size : 24px; // equiv "24px" -@h4-size : 20px; // equiv "20px" -@h5-size : 18px; // equiv "18px" -@h6-size : 16px; // equiv "16px" +@basefont : 14px; // if "14px" then 1em = 14px +@lh : 1.5; // equiv line-height 1.5em +@h1-size : 32px; // equiv "32px" +@h2-size : 28px; // equiv "28px" +@h3-size : 24px; // equiv "24px" +@h4-size : 20px; // equiv "20px" +@h5-size : 18px; // equiv "18px" +@h6-size : 16px; // equiv "16px" // font stacks -@fontstack1 : Helvetica, Arial, sans-serif; // common font -@fontstack2 : Consolas, 'DejaVu Sans Mono', Courier, monospace; // monospace font -@fontstack3 : FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; // universal stack +@fontstack1 : Helvetica, Arial, sans-serif; // common font +@fontstack2 : Consolas, 'DejaVu Sans Mono', Courier, monospace; // monospace font +@fontstack3 : FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; // universal stack // font colors @basecolor : #000; // text color on body @@ -40,7 +49,7 @@ @ultra-large-screen : 1600px; // ultra large screens media query // misc -@gutter : 20px; // gutter value (%, px, em, rem) for grid layouts +@gutter : 20px; // gutter value (%, px, em, rem) for grid layouts diff --git a/less/01-base.less b/less/01-base.less index 955e9ea..30cdee2 100644 --- a/less/01-base.less +++ b/less/01-base.less @@ -126,46 +126,12 @@ kbd { font-family: @fontstack2; line-height: normal; } -code, kbd, mark { - border-radius: 2px; -} em { font-style: italic; } strong { font-weight: bold; } -kbd { - padding: 0 2px; - border: 1px solid #999; -} -code { - padding: 2px 4px; - background: rgba(0,0,0,.04); - color: #b11; -} -pre code { - padding: none; - background: none; - color: inherit; - border-radius: 0; -} -mark { - padding:2px 4px; - background: #ff0; -} -sup, -sub { - vertical-align: 0; - position: relative; -} -sup { - bottom: 1ex; -} -sub { - top: .5ex; -} - /* ----------------------------- */ /* == hiding content */ @@ -180,29 +146,6 @@ sub { height: 1px; width: 1px; } - -/* ----------------------------- */ -/* == skip links styling */ -/* ----------------------------- */ - -.skip-links { - position: absolute; - - a { - position: absolute; - left: -7000px; - padding: 0.5em; - background: black; - color: white; - text-decoration: none; - - &:focus { - position: static; - } - } -} - - /* ----------------------------- */ /* == browsers consistency */ /* ----------------------------- */ @@ -324,154 +267,92 @@ img.start, img.end { .txtcenter { text-align: center; } -/* ----------------------------- */ -/* == width helpers */ -/* .. use only when needed */ -/* ----------------------------- */ +// width helpers boolean +& when (@helpers-width = true) { + /* blocks widths (percentage and pixels) */ + .w10 { width: 10%; } + .w20 { width: 20%; } + .w25 { width: 25%; } + .w30 { width: 30%; } + .w33 { width: 33.3333%; } + .w40 { width: 40%; } + .w50 { width: 50%; } + .w60 { width: 60%; } + .w66 { width: 66.6666%; } + .w70 { width: 70%; } + .w75 { width: 75%; } + .w80 { width: 80%; } + .w90 { width: 90%; } + .w100 { width: 100%; } -/* blocks widths (percentage and pixels) */ -.w10 { width: 10%; } -.w20 { width: 20%; } -.w25 { width: 25%; } -.w30 { width: 30%; } -.w33 { width: 33.3333%; } -.w40 { width: 40%; } -.w50 { width: 50%; } -.w60 { width: 60%; } -.w66 { width: 66.6666%; } -.w70 { width: 70%; } -.w75 { width: 75%; } -.w80 { width: 80%; } -.w90 { width: 90%; } -.w100 { width: 100%; } - -.w50p { width: 50px; } -.w100p { width: 100px; } -.w150p { width: 150px; } -.w200p { width: 200px; } -.w300p { width: 300px; } -.w400p { width: 400px; } -.w500p { width: 500px; } -.w600p { width: 600px; } -.w700p { width: 700px; } -.w800p { width: 800px; } -.w960p { width: 960px; } -.mw960p { max-width: 960px; } -.w1140p { width: 1140px; } -.mw1140p { max-width: 1140px; } -.wauto { width: auto; } - - -/* ----------------------------- */ -/* == spacing helpers */ -/* .. use only when needed */ -/* ----------------------------- */ - -/* spacing helpers -p,m = padding,margin -a,t,r,b,l = all,top,right,bottom,left -s,m,l,n = small(10px),medium(20px),large(30px),none(0) -source https://github.com/stubbornella/oocss/blob/master/core/spacing/space.css -*/ -.m-reset, .ma0 { margin: 0; } -.p-reset, .pa0 { padding: 0; } -.ma1, .mas { margin: @small-value; } -.ma2, .mam { margin: @medium-value; } -.ma3, .mal { margin: @large-value; } -.pa1, .pas { padding: @small-value; } -.pa2, .pam { padding: @medium-value; } -.pa3, .pal { padding: @large-value; } - -.mt0, .mtn { margin-top: 0; } -.mt1, .mts { margin-top: @small-value; } -.mt2, .mtm { margin-top: @medium-value; } -.mt3, .mtl { margin-top: @large-value; } -.mr0, .mrn { margin-right: 0; } -.mr1, .mrs { margin-right: @small-value; } -.mr2, .mrm { margin-right: @medium-value; } -.mr3, .mrl { margin-right: @large-value; } -.mb0, .mbn { margin-bottom: 0; } -.mb1, .mbs { margin-bottom: @small-value; } -.mb2, .mbm { margin-bottom: @medium-value; } -.mb3, .mbl { margin-bottom: @large-value; } -.ml0, .mln { margin-left: 0; } -.ml1, .mls { margin-left: @small-value; } -.ml2, .mlm { margin-left: @medium-value; } -.ml3, .mll { margin-left: @large-value; } - -.pt0, .ptn { padding-top: 0; } -.pt1, .pts { padding-top: @small-value; } -.pt2, .ptm { padding-top: @medium-value; } -.pt3, .ptl { padding-top: @large-value; } -.pr0, .prn { padding-right: 0; } -.pr1, .prs { padding-right: @small-value; } -.pr2, .prm { padding-right: @medium-value; } -.pr3, .prl { padding-right: @large-value; } -.pb0, .pbn { padding-bottom: 0; } -.pb1, .pbs { padding-bottom: @small-value; } -.pb2, .pbm { padding-bottom: @medium-value; } -.pb3, .pbl { padding-bottom: @large-value; } -.pl0, .pln { padding-left: 0; } -.pl1, .pls { padding-left: @small-value; } -.pl2, .plm { padding-left: @medium-value; } -.pl3, .pll { padding-left: @large-value; } - - -/* ----------------------------- */ -/* == iefix */ -/* ----------------------------- */ - -/* Make sure you are using Conditional Classes in your HTML */ -/* see : http://www.alsacreations.com/astuce/lire/988-classes-conditionnelles-HTML.html */ - -.ie678 h1, .ie678 .h1-like { - .em(@h1-size); -} -.ie678 h2, .ie678 .h2-like { - .em(@h2-size); -} -.ie678 h3, .ie678 .h3-like { - .em(@h3-size); -} -.ie678 h4, .ie678 .h4-like { - .em(@h4-size); -} -.ie678 h5, .ie678 .h5-like { - .em(@h5-size); -} -.ie678 h6, .ie678 .h6-like { - .em(@h6-size); + .w50p { width: 50px; } + .w100p { width: 100px; } + .w150p { width: 150px; } + .w200p { width: 200px; } + .w300p { width: 300px; } + .w400p { width: 400px; } + .w500p { width: 500px; } + .w600p { width: 600px; } + .w700p { width: 700px; } + .w800p { width: 800px; } + .w960p { width: 960px; } + .mw960p { max-width: 960px; } + .w1140p { width: 1140px; } + .mw1140p { max-width: 1140px; } + .wauto { width: auto; } } -/* hasLayout for IE6/IE7 */ -.ie67 .clearfix, -.ie67 .line, -.ie67 .mod, -.ie67 .row, -.ie67 .col { - zoom: 1; -} -/* inline-block and table-cell for IE6/IE7 */ -/* warning: .col needs width on IE6/IE7 */ -.ie67 .btn, -.ie67 .col, -.ie67 .inbl { - display: inline; - zoom: 1; -} -.ie8 img { - width: auto; /* @bugfix for IE8 */ -} +// spacing helpers boolean +& when (@helpers-spacing = true) { + /* spacing helpers + p,m = padding,margin + a,t,r,b,l = all,top,right,bottom,left + s,m,l,n = small, medium, large, none + */ + .m-reset, .ma0 { margin: 0; } + .p-reset, .pa0 { padding: 0; } + .ma1, .mas { margin: @small-value; } + .ma2, .mam { margin: @medium-value; } + .ma3, .mal { margin: @large-value; } + .pa1, .pas { padding: @small-value; } + .pa2, .pam { padding: @medium-value; } + .pa3, .pal { padding: @large-value; } -/* Active box-sizing for IE6/IE7 */ -/* @source https://github.com/Schepp/box-sizing-polyfill */ -/* -.ie67 * { - behavior: url(/lib/box-sizing-polyfill/boxsizing.htc); -} -*/ + .mt0, .mtn { margin-top: 0; } + .mt1, .mts { margin-top: @small-value; } + .mt2, .mtm { margin-top: @medium-value; } + .mt3, .mtl { margin-top: @large-value; } + .mr0, .mrn { margin-right: 0; } + .mr1, .mrs { margin-right: @small-value; } + .mr2, .mrm { margin-right: @medium-value; } + .mr3, .mrl { margin-right: @large-value; } + .mb0, .mbn { margin-bottom: 0; } + .mb1, .mbs { margin-bottom: @small-value; } + .mb2, .mbm { margin-bottom: @medium-value; } + .mb3, .mbl { margin-bottom: @large-value; } + .ml0, .mln { margin-left: 0; } + .ml1, .mls { margin-left: @small-value; } + .ml2, .mlm { margin-left: @medium-value; } + .ml3, .mll { margin-left: @large-value; } + .pt0, .ptn { padding-top: 0; } + .pt1, .pts { padding-top: @small-value; } + .pt2, .ptm { padding-top: @medium-value; } + .pt3, .ptl { padding-top: @large-value; } + .pr0, .prn { padding-right: 0; } + .pr1, .prs { padding-right: @small-value; } + .pr2, .prm { padding-right: @medium-value; } + .pr3, .prl { padding-right: @large-value; } + .pb0, .pbn { padding-bottom: 0; } + .pb1, .pbs { padding-bottom: @small-value; } + .pb2, .pbm { padding-bottom: @medium-value; } + .pb3, .pbl { padding-bottom: @large-value; } + .pl0, .pln { padding-left: 0; } + .pl1, .pls { padding-left: @small-value; } + .pl2, .plm { padding-left: @medium-value; } + .pl3, .pll { padding-left: @large-value; } +} /* ----------------------------- */ /* == quick print reset */ diff --git a/less/06-rwd.less b/less/06-rwd.less index df8eb0a..3d671be 100644 --- a/less/06-rwd.less +++ b/less/06-rwd.less @@ -87,12 +87,6 @@ vertical-align: top !important; } - /* you shall not pass */ - div, textarea, table, td, th, code, pre, samp { - word-wrap: break-word; - hyphens: auto; - } - /* widths for small screens */ .small-w25 { width: 25% !important; } .small-w33 { width: 33.3333% !important; } diff --git a/less/09-booleans.less b/less/09-booleans.less new file mode 100644 index 0000000..12e39c6 --- /dev/null +++ b/less/09-booleans.less @@ -0,0 +1,147 @@ +@import "00-config"; + +// Styling boolean +& when (@styling = true) { + code, kbd, mark { + border-radius: 2px; + } + kbd { + padding: 0 2px; + border: 1px solid #999; + } + code { + padding: 2px 4px; + background: rgba(0,0,0,.04); + color: #b11; + } + pre code { + padding: none; + background: none; + color: inherit; + border-radius: 0; + } + mark { + padding:2px 4px; + background: #ff0; + } + sup, + sub { + vertical-align: 0; + position: relative; + } + sup { + bottom: 1ex; + } + sub { + top: .5ex; + } + blockquote { + margin-left: 0; + padding-left: 1em; + border-left: 4px solid rgba(0,0,0,.15); + font-style: italic; + } + q { + font-style: normal; + } + q, + .q { + quotes: "“\00a0" "\00a0”"; + } + q:lang(fr), + .q:lang(fr) { + quotes: "«\00a0" "\00a0»"; + } + hr { + display: block; + clear: both; + height: 1px; + margin: 1em 0 2em; + padding: 0; + border: 0; + color: #ccc; + background-color: #ccc; + } +} + +// IE6, 7, 8 support boolean +& when (@ie678 = true) { + + .ie678 h1, .ie678 .h1-like { + .em(@h1-size); + } + .ie678 h2, .ie678 .h2-like { + .em(@h2-size); + } + .ie678 h3, .ie678 .h3-like { + .em(@h3-size); + } + .ie678 h4, .ie678 .h4-like { + .em(@h4-size); + } + .ie678 h5, .ie678 .h5-like { + .em(@h5-size); + } + .ie678 h6, .ie678 .h6-like { + .em(@h6-size); + } + .ie678 img { + width: auto; /* @bugfix for IE8 */ + } + + /* hasLayout for IE6/IE7 */ + .clearfix, + .line, + .mod, + .row, + .col { + *zoom: 1; + } + /* inline-block and table-cell for IE6/IE7 */ + /* warning: .col needs width on IE6/IE7 */ + .btn, + .col, + .inbl { + *display: inline; + *zoom: 1; + } + + /* Active box-sizing for IE6/IE7 */ + /* @source https://github.com/Schepp/box-sizing-polyfill */ + /* + .ie67 * { + behavior: url(/lib/box-sizing-polyfill/boxsizing.htc); + } + */ +} + +// skip-links boolean +& when (@skip-links = true) { + .skip-links { + position: absolute; + + a { + position: absolute; + left: -7000px; + padding: 0.5em; + background: black; + color: white; + text-decoration: none; + + &:focus { + position: static; + } + } + } +} + +// hyphens boolean +& when (@hyphens = true) { + @media (max-width: @small-screen) { + /* you shall not pass */ + div, textarea, table, td, th, code, pre, samp { + word-wrap: break-word; + hyphens: auto; + } + } +} diff --git a/less/knacss.less b/less/knacss.less index a07e790..266b649 100644 --- a/less/knacss.less +++ b/less/knacss.less @@ -12,6 +12,7 @@ @import "06-rwd"; @import "07-flexbox"; @import "08-print"; +@import "09-booleans"; /* ----------------------------- */ /* ==own stylesheet */