Hamza Erbay @Udemy
getbootstrap.com
lescss.org
// Variables
@link-color: #428bca; // sea blue
@link-color-hover: darken(@link-color, 10%);
// Usage with nested
a {
color: @link-color;
&:hover {
color: @link-color-hover;
}
}
//mixins
.average(@x, @y) {
@average: ((@x + @y) / 2);
}
div {
.average(16px, 50px); // "call" the mixin
padding: @average; // use its "return" value
}
//loops
.loop(@counter) when (@counter > 0) {
.loop((@counter - 1)); // next iteration
width: (10px * @counter); // code for each iteration
}
div {
.loop(5); // launch the loop
}
udemy.com/docs/style-guide/css
udemy.com/docs/style-guide/cheat-sheet
<form class="site-search full">
<input type="text" class="field">
<input type="Submit" class="button" value ="Search">
</form>
<form class="site-search site-search--full">
<input type="text" class="site-search__field">
<input type="Submit" class="site-search__button" value ="Search">
</form>
Bem
Normal
//Less
.site-search {
...
&--full {...}
&__button {...}
&__field {...}
}
//Css
.site-search {...} /* Block */
.site-search--full {...} /* Modifier */
.site-search__field {...} /* Element */
.site-search__button {...} /* Element */
//Less
.site-search {
...
.field {...}
.button {...}
&.full {...}
}
//Css
.site-search {...}
.site-search .field {...}
.site-search .button {...}
.site-search.full {...}
Course cards sample
http://bit.ly/1TiEOQr
https://en.bem.info/method/
https://css-tricks.com/bem-101/
http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/