Beginning css preprocessors



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

Listing 3-28.  Example of Implementing @at-root

.productImage {

  height: 150px;

  width: 150px;

 

  @at-root {



    @keyframes panimate {

      0% { transform: scale(1.0); }

      25% { transform: scale(1.1); }

      50% { transform: scale(1.2); }

      75% { transform: scale(1.1); }

      100% { transform: scale(1.0); }

    }

  }


  &:hover {

    animation: panimate .8s infinite;

  }

}



Chapter 3 

 advanCed SaSS



46

In this example, you can see that putting an animation declaration that will be used for this specific 

element inside the definition with @at-root increases the overall code readability.

Listing 3-29.  Output of Listing 

3-28


.productImage {

  height: 150px;

  width: 150px;

}

 



@keyframes panimate {

  0% {


    transform: scale(1);

  }


  25% {

    transform: scale(1.1);

  }

  50% {


    transform: scale(1.2);

  }


  75% {

    transform: scale(1.1);

  }

  100% {


    transform: scale(1);

  }


}

 

.productImage:hover {



  animation: panimate 0.8s infinite;

}

Mixin Directives



As your CSS grows, you’ll come across situations where you need to replicate entire chunk of styles as-is or 

with slight variations.

Mixins, declared using @mixin, are used to create reusable style code that can be used across the entire 

stylesheet. Mixins can contain full CSS rules. Mixins can take arguments, which makes them flexible.

Mixins are defined using the @mixin directive followed by the name of the mixin and optional argument 

and block containing code, as shown in Listing 

3-30

.


Download 2,42 Mb.

Do'stlaringiz bilan baham:
1   ...   39   40   41   42   43   44   45   46   ...   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