more variables in config.less

This commit is contained in:
Raphael Goetter 2013-11-22 17:35:03 +01:00
parent d2c19663e1
commit 330f6adb0c
3 changed files with 47 additions and 19 deletions

View File

@ -3,6 +3,12 @@
// LESS values : adapt them to your design // LESS values : adapt them to your design
@basefont : 14px; // if "14px" then 1em = 14px @basefont : 14px; // if "14px" then 1em = 14px
@lh : 1.5; // equiv line-height 1.5em @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"
@basecolor : #000; // text color on body @basecolor : #000; // text color on body
@basebg : #fff; // body background color @basebg : #fff; // body background color
@basecolor-link : #333; // primary links color; @basecolor-link : #333; // primary links color;
@ -14,26 +20,26 @@
@smallscreen : 768px; // small screens media query @smallscreen : 768px; // small screens media query
@largescreen : 1280px; // large screens media query @largescreen : 1280px; // large screens media query
@gutter : 20px; // gutter value (%, px, em, rem, etc) for grid layouts @gutter : 20px; // gutter value (%, px, em, rem, etc) for grid layouts
@fontstack1 : helvetica, arial, sans-serif; // common font @fontstack1 : Helvetica, Arial, sans-serif; // common font
@fontstack2 : consolas, 'DejaVu Sans Mono', courier, monospace; // monospace font @fontstack2 : Consolas, 'DejaVu Sans Mono', Courier, monospace; // monospace font
@fontstack3 : FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; // universal stack @fontstack3 : FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; // universal stack
// LESS mixins : don't touch or you'll be banned ;) // LESS mixins : don't touch or you'll be banned ;)
// px to em/rem // px to em/rem
.rem(@size, @bf: @basefont){ .rem(@size, @bf: @basefont){
@em: round((@size / @bf),4);
font-size: unit(@em, em);
@rem: round((@size / 10),4); @rem: round((@size / 10),4);
font-size: unit(@rem, rem); font-size: unit(@rem, rem);
} }
.em(@size, @bf: @basefont){
@em: round((@size / @bf),4);
font-size: unit(@em, em);
}
// flow for headings // flow for headings
.flow(@size, @bf: @basefont, @bh: @lh) { .flow(@size, @bf: @basefont, @bh: @lh) {
@marg: @bh * @bf / @size; @marg: @bh * @bf / @size;
@mt: unit(round(@marg,4),em); @mt: unit(@marg,em);
margin-top: @mt; margin-top: @mt;
margin-bottom: 0; margin-bottom: 0;
@em: round((@size / @bf),4);
font-size: unit(@em, em);
@rem: round((@size / 10),4); @rem: round((@size / 10),4);
font-size: unit(@rem, rem); font-size: unit(@rem, rem);
@coef: ceil(1/@mt); @coef: ceil(1/@mt);

View File

@ -36,39 +36,39 @@ hgroup {
line-height: @lh; line-height: @lh;
} }
h1, .h1-like { h1, .h1-like {
.flow(32px); // equiv 32px .flow(@h1-size);
} }
h2, .h2-like { h2, .h2-like {
.flow(28px); // equiv 28px .flow(@h2-size);
} }
h3, .h3-like { h3, .h3-like {
.flow(24px); // equiv 24px .flow(@h3-size);
} }
h4, .h4-like { h4, .h4-like {
.flow(20px); // equiv 20px .flow(@h4-size);
} }
h5, .h5-like { h5, .h5-like {
.flow(18px); // equiv 18px .flow(@h5-size);
} }
h6, .h6-like { h6, .h6-like {
.flow(16px); // equiv 16px .flow(@h6-size);
} }
/* alternate font-sizing */ /* alternate font-sizing */
.smaller { .smaller {
.rem (10px); /* equiv 10px */ .em(@basefont - 4);
} }
.small { .small {
.rem (12px); /* equiv 12px */ .em(@basefont - 2);
} }
.big { .big {
.rem (16px); /* equiv 16px */ .em(@basefont + 2);
} }
.bigger { .bigger {
.rem (18px); /* equiv 18px */ .em(@basefont + 4);
} }
.biggest { .biggest {
.rem (20px); /* equiv 20px */ .em(@basefont + 6);
} }
/* soft reset */ /* soft reset */
@ -90,7 +90,7 @@ samp,
kbd { kbd {
white-space: pre-wrap; white-space: pre-wrap;
font-family: @fontstack2; font-family: @fontstack2;
line-height: 1em; line-height: 1;
} }
code, kbd, mark { code, kbd, mark {
border-radius: 2px; border-radius: 2px;
@ -360,6 +360,28 @@ source https://github.com/stubbornella/oocss/blob/master/core/spacing/space.css
/* ==iefix */ /* ==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);
}
/* haslayout for IE6/IE7 */ /* haslayout for IE6/IE7 */
.ie67 .clearfix, .ie67 .clearfix,
.ie67 .line, .ie67 .line,

Binary file not shown.