⊗mkLsBsMxNP 20 of 42 menu

SASS'ta Mixin'lerde İsimlendirilmiş Parametreler

Mixin'lere isimlendirilmiş parametreler verebiliriz. Bunu aşağıdaki örnek üzerinde inceleyelim:

@mixin active($color) { border: { color: $color; style: solid; } } p { @include active($color: orange); } div { @include active($color: green); }

Derleme sonucu:

p { border-color: orange; border-style: solid; } div { border-color: green; border-style: solid; }

Ayrıca, mixin'lere varsayılan parametre değerleri de verebiliriz:

@mixin active($color, $width: 2px) { border: { color: $color; width: $width; style: dotted; } } p { @include active(yellow); } div { @include active(yellow, 4px); }

Derleme sonrasında şunu göreceğiz:

p { border-color: yellow; border-width: 2px; border-style: dotted; } div { border-color: yellow; border-width: 4px; border-style: dotted; }

Aşağıdaki kodun derleme sonucunun ne olacağını açıklayın:

@mixin super-button($color, $background-color, $border-radius) { color: $color; background-color: $background-color; border-radius: $border-radius; } .active-button { @include super-button($color: white, $background-color: red, $border-radius: 2px); }

Aşağıdaki kodun derleme sonucunun ne olacağını açıklayın:

@mixin super-button($color, $background-color, $border-radius: 5px) { color: $color; background-color: $background-color; border-radius: $border-radius; } .active-button { @include super-button($color: white, $background-color: red); }

Aşağıdaki kodun derleme sonucunun ne olacağını açıklayın:

@mixin super-button($color, $background-color: orange, $border-radius: 5px) { color: $color; background-color: $background-color; border-radius: $border-radius; } .active-button { @include super-button($color: white, $border-radius:3px); }
Türkçe
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEnglishEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenЎзбекOʻzbekTiếng Việt
Web sitesinin çalışması, analiz ve kişiselleştirme için çerezleri kullanıyoruz. Veri işleme, Gizlilik Politikası'na uygun olarak gerçekleşir.
tümünü kabul et özelleştir reddet