Create a Sass Mixin with @mixin
📖 Scenario: You are building a website and want to reuse a style block for buttons. Instead of repeating the same styles, you will create a Sass mixin to keep your code clean and easy to update.
🎯 Goal: Create a Sass mixin named button-style that sets the background color to blue, text color to white, and padding to 1rem. Then use this mixin inside a CSS class .btn.
📋 What You'll Learn
Define a mixin called
button-style using @mixinInside the mixin, set
background-color to blueSet
color to white inside the mixinSet
padding to 1rem inside the mixinCreate a CSS class
.btn that includes the button-style mixin using @include💡 Why This Matters
🌍 Real World
Mixins let you write reusable style blocks in Sass, saving time and making your CSS easier to maintain.
💼 Career
Web developers use Sass mixins to create scalable and clean style sheets for websites and apps.
Progress0 / 4 steps