I'm using LESS as css compiler.
Everything works fine, but now I need to create a specific class structure and I'm a bit stuck.
I'd like to have this structure:
.default .{color} {.icon-after/.icon-before} {.icon}
this is the code that I've done:
.default {
&.disabled {
background: lighten(@grayBackground, 5%);
color: lighten(@darkText, 35%);
cursor: default;
border: @grayBorder;
text-shadow: @grayTextShadow;
}
&.gray {
background: @grayBackground;
color: @darkText;
border: @grayBorder;
text-shadow: @grayTextShadow;
&:hover {
background: darken(@grayBackground, 5%);
}
}
&.green {
background: @greenBackground;
border: @greenBorder;
color: @lightText;
text-shadow: @greenTextShadow;
&:hover {
background: darken(@greenBackground, 10%);
}
}
&.yellow {
background: @yellowBackground;
border: @yellowBorder;
color: @lightText;
text-shadow: @yellowTextShadow;
&:hover {
background: darken(@yellowBackground, 10%);
}
}
&.blue {
background: @blueBackground;
border: @blueBorder;
color: @lightText;
text-shadow: @blueTextShadow;
&:hover {
background: darken(@blueBackground, 10%);
}
}
&.black {
background: @blackBackground;
border: @blackBorder;
color: @lightText;
text-shadow: @blackTextShadow;
&:hover {
background: darken(@blackBackground, 10%);
}
}
&.red {
background: @redBackground;
border: @redBorder;
color: @lightText;
text-shadow: @redTextShadow;
&:hover {
background: darken(@redBackground, 10%);
}
}
&.icon-before{
.IconDefaultStyleBefore
}
&.icon-after{
.IconDefaultStyleAfter()
}
}
obviously this doesn't work, as the result is something like this:
.default .{color / .icon-after / .icon-before}
Any suggestions on how can I obtain my structure?
Thanks a lot
EDIT
I'd like to add the classes to the buttons in this order:
- .default( gives the default style )
- {.colours} (so that the background, the border and all colour related properties are setted)
- {.icon-after or .icon-before} so that I can choose if adding the icon before or after with the proper margin
- {.icon-name} (for example a questionmark or a tick etc)
so, for example, adding this classes:
.default .blue .icon-before .tick
I will have:
default blue button with the tick icon before the text
Hope is now more clear than before.