Skip to content

Instantly share code, notes, and snippets.

@pietvanzoen
Last active December 19, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pietvanzoen/5967376 to your computer and use it in GitHub Desktop.
Save pietvanzoen/5967376 to your computer and use it in GitHub Desktop.
LESS Extend :: #css
/** EXAMPLE 1
---------------------------------------- **/
/* LESS */
.museo,h1,h2,h3 {
font-family:"Museo",sans-serif;
}
.nav {
/* some css */
&:extend(.museo);
}
/* Compiled CSS */
.museo,h1,h2,h3,
.nav {
font-family:"Museo",sans-serif
}
.nav {
/* some css */
}
/** EXAMPLE 2
** Take note of 'all' this tells LESS to extend
** .nav to all the nested styles too.
---------------------------------------- **/
/* LESS */
.clearfix { *zoom:1;
&:before, &:after {content:""; display:table; }
&:after { clear:both; }
}
.nav {
/* some css */
&:extend(.clearfix all);
}
/* Compiled CSS */
.clearfix,
.nav {
*zoom: 1;
}
.clearfix:before,
.nav:before,
.clearfix:after,
.nav:after {
content: "";
display: table;
}
.clearfix:after,
.nav:after {
clear: both;
}
.nav {
/* some css */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment