How to define a mixin in css?

Haider Ali Shaikh
Haider Ali Shaikh

Posted On: Apr 10, 2020

 

Mixins in CSS is used to define patterns of property-value pairs that can be reused. It is used by the document authors to group vendor prefixes and to simplify the code.

To define a mixin, the @mixin keyword should be followed by the mixin name with a declaration block.

//example of mixin definition
@mixin .rounded7px {
  -moz-border-radius: 7px;
}

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Front end Developer Interview Questions

    What is HTML?

    HTML (HyperText Markup Language) is a markup language to design the web page. It is used to display the contents of the web page in order. They are the building blocks of the HTML pages. This text-bas...

    Front end Developer Interview Questions

    What is Ajax?

    Ajax (Asynchronous Javascript and XML) is a technique to create asynchronous web applications. Applications developed with Ajax can send and retrieve data asynchronously from the server without interf...

    Front end Developer Interview Questions

    What is npm?

    NPM stands for Node Package Manager. It is used to install, uninstall, update packages for Javascript Programming Language. NPM also is a default package manager for Node.js....