I have a few Less utility that I used as extends - this is a typical scenario.
.clearfix
{
&:before,
&:after {
content:"";
display:table;
}
&:after {
clear:both;
}
}
However, now I use media queries, and the extension does not apply to all these scenarios.
What I would like to do is declare the code once and reuse it. I came up with this template that works and allows me to use the utility inside media queries or where it suits.
The question is that I am doing it wrong, and the extension should work inside the media query or better deal with it.
.clearfix
{
@clearfix();
}
@clearfix :
{
&:before,
&:after {
content:"";
display:table;
}
&:after {
clear:both;
}
};
Thanks in advance.
source
share