Beginning css preprocessors



Download 2,42 Mb.
Pdf ko'rish
bet45/59
Sana01.01.2022
Hajmi2,42 Mb.
#285229
1   ...   41   42   43   44   45   46   47   48   ...   59
Bog'liq
Beginning CSS Preprocessors

Listing 3-32.  Example of a Compound Mixin

@mixin success {

  @include notification;

  @include successTheme;

}

Mixin arguments are written in variable format, separated by commas if more than one argument is 



there. These arguments can have default values that will be used if no value is provided as an argument.

Listing 3-33.  Passing a Block of Code as an Argument to a Mixin

@mixin clearFix {

  &:after {

    @content;

  }

}

 



.btn {

  display: inline-block;

  @include clearFix {

    clear:both;

  }

}

Listing 3-34.  Output of Listing 



3-33

.btn {


  display: inline-block;

}

 



.btn:after {

  clear: both;

}



Chapter 3 

 advanCed SaSS



48

Mixins versus Classes

Mixins make reusing styles in a stylesheet very easy. Any piece of style code that’s repeated is a good 

candidate for a mixin. For example, a group of properties that make sense to set together like border radius

background gradient, and so on, would be a good mixin.

Mixins are very similar to CSS classes. Both let you store chunks of style. The most important difference 

between these two is that classes are meant to be used in your HTML, whereas mixins are used to create 

reusable chunks to use within stylesheets.

Hence, the classes should have a meaningful name that properly identifies the element. Mixins names 

should be related to the functionality they provide.

Mixins with CSS Selectors

Mixins can contain CSS selectors in addition to properties. This is demonstrated in Listing 

3-35

.


Download 2,42 Mb.

Do'stlaringiz bilan baham:
1   ...   41   42   43   44   45   46   47   48   ...   59




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish