Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Less Parametric Mixins

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 214
    Comment on it

    LESS mixins can be extended into sort of functions in which they accept parameters more than once, it is being called Parametric Mixins. Through these parameters you are able to customize the mixin output in according to what you passed through the parameters.

    .border(@border-width; @border-style; @border-color) {
        border: @border-width @border-style @border-color;
    }
    

    The above code snippet shows our previous .border mixin has now turned into a Parametric Mixin with three parameters. Now, we are able to customize the border property values, namely the border-width, style, and color, for instance:

    .header {
        .border(2px; dotted; red);
    }
    

    Output

    .header {
        border: 2px dotted #ff0000;
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: