I have been working with SASS for sometime now. Today I came across an interesting issue where i had to style individual elements that had specific styles attached to it.
awesomeproduct, Tell me about it!
spbsm
domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init
action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/znadzweb38948co/public_html/wp-includes/functions.php on line 6121I have been working with SASS for sometime now. Today I came across an interesting issue where i had to style individual elements that had specific styles attached to it.
awesomeproduct, Tell me about it!
So I wrote a mixin as below:
@mixin generateClassNamesWithVariables($start,$stop, $classname, $css-element, $spacer){ @for $i from $start through $stop { .#{$classname}#{$i*$spacer} { #{$css-element}: #{$i * $spacer}px; } } }
This is how i have used the above mixin:
@include generateClassNamesWithVariables(1,5,margin-,margin,10); @include generateClassNamesWithVariables(1,5,margin-top-,margin-top,10); @include generateClassNamesWithVariables(1,5,margin-bottom-,margin-bottom,10); @include generateClassNamesWithVariables(1,5,pad-right-,padding-right,10); @include generateClassNamesWithVariables(1,5,pad-left-,padding-left,10); @include generateClassNamesWithVariables(1,5,pad-top-,padding-top,5); @include generateClassNamesWithVariables(1,5,pad-bottom-,padding-bottom,5); @include generateClassNamesWithVariables(1,5,pad-,padding,10); @include generateClassNamesWithVariables(10,30,f,font-size,1);
So what this mixin will do is generate the following css.
Now the html will be something like this, it is much cleaner and works like a charm!
Anawesomeproduct
good post mate, keep it up…chuur…
Hello there, I found your blog via Google at the same time as looking for a related topic, your website came up, it appears great. I’ve bookmarked it in my google bookmarks.
What’s up to every single one, it’s in fact
a nice for me to pay a quick visit this web page, it consists of important Information.
An intriguing discussion may be worth comment. I think that
you need to write a little more about this issue.