๐๐ซ๐จ๐๐ฅ๐๐ฆ?
Assume, you are styling a responsive web application. When styling for different screen sizes, you often need to write multiple @media queries. This can lead to repeating @media statements throughout your CSS file. How can we avoid it?
๐๐จ๐ฅ๐ฎ๐ญ๐ข๐จ๐ง?
Sass solves this problem by Mixin. Mixins allow you to define styles that can be re-used throughout your stylesheet.
๐๐จ๐ฐ?
๐ Install Sass โ npm install sass.
๐ Define a mixing named it screen-style with the argument of size screen and in the body use @content (take an entire block of styles).
๐ Define a new mixin named it small-breakpoint and use name of previous mixin with @include (it will be included in the previous mixin).
๐ Define the desired selector.
๐ Use the small-breakpoint mixin with @include inside the selector.
๐ Add the desired styles.
โ ๐๐๐ฏ๐ ๐ฒ๐จ๐ฎ ๐๐ฏ๐๐ซ ๐ฎ๐ฌ๐ ๐๐ข๐ฑ๐ข๐ง๐ฌ? ๐๐ ๐ฌ๐จ, ๐๐ก๐๐ซ๐ ๐ฒ๐จ๐ฎ๐ซ ๐๐ฑ๐ฉ๐๐ซ๐ข๐๐ง๐๐ ๐ข๐ง ๐ญ๐ก๐ ๐๐จ๐ฆ๐ฆ๐๐ง๐ญ.
hashtag#CSS hashtag#Sass hashtag#FrontendDevelopment hashtag#WebDevelopment hashtag#CleanCode

Top comments (0)