Mixins
Anotheradvantageofusingpreprocessorsistheabilitytocreatereusablesnippets
ofcodeintheformofmixins.Mixinsaregreatformanagingvendorprefixes,or
reusingparticularstylesinmultipleplaces.Thesyntaxdiffersquiteabitbetween
LessandSass,buttheconceptislargelythesame.Mixins in Less
WithLess,mixinslookalotlikeCSSselectors.Infact,they’remostlythesame.For
example,youcancreateaclassthataddsdisplay: inline-blocktoanelement:.dib {
display: inline-block;
}Youcouldaddthefollowingclasstoyourmarkup:<p class="dib">.Butifyou’d
ratherkeepyourmarkupsimpleandhighlysemantic,youmightinsteadturnthis
.dibclassintoamixin:.dib {
display: inline-block;
}p {
.dib;
font-size: 16px;
}Whencompiled,Lesswillincludebothour.dibclassanddisplay: inline-block
aspartofourpruleset:.dib {
display: inline-block;
}p {342 CSS Master