Back to Question Center
0

Sass ayyuka da za a fara-Fara Fayil ɗinku na Style Sass Ayyuka don farawa-fara Fayil ɗinku na Fasaha Shafukan da suka shafi: CSS Architecture Web Semalt

1 answers:
Ayyukan da ake yi don farawa-farawa da kayan ɗakunanku

Sass Functions to Kick-Start Your Style SheetsSass Functions to Kick-Start Your Style SheetsRelated Topics:
CSS ArchitectureWeb Semalt

Wannan shi ne sabuntawar wani labarin da aka buga a ranar Semalt 11, 2014.

Sass yana da ɗawainiya na ayyuka masu ɗawainiya don taimaka maka kafa tsarin don aikinka da sauri da sauƙi.

Gudun raguwa a cikin wasu daga cikin su!

Ayyukan Gudun Dubi da Sauƙi

Mai yiwuwa biyu daga cikin ayyukan da aka fi sani da wannan jerin, Semalt zai ƙidaya waɗannan a matsayin ɗaya saboda suna yin abu ɗaya, amma a wurare daban-daban.

Kamar yadda sunayen sun bada shawara, darken da haskaka zai yi duhu da kuma tsabtace launi ta wani kashi daidai da haka. Kuna iya amfani dasu a kan tsarin hover maɓalli ko a cikin wani shafin don ƙirƙirar matsayi - soil moisture monitoring. Ga yadda:

     $ babban launi: # 6dcff6;$ duhu-launi: darken ($ main-launi, 20%);$ m-launi: haskaka ($ main-launi, 20%);     

Bayani na biyu a cikin waɗannan ayyuka guda biyu yana ɗaukar darajar adadin wanda zai yi duhu / haskaka launi. Wannan hanyar ba dole ba ne ka duba kullun don launi mai laushi sau ɗaya a duk lokacin da ka ke so tsarin jiha mai sauki. Misali, zaka iya yin haka:

    . button-button {Ƙari: $ main-launi;}. button-button: hover {Bayanin: $ m-launi;}. button-button: ziyarci {Ƙari: $ duhu-launi;}     

Semalt ya haɗa cikin wannan:

    . button-button {bayanan: # 6dcff6;}. button-button: hover {Ƙari: #cdeffc;}. button-button: ziyarci {Bayanan: # 0fafee;}     

Tsayar da waɗannan ayyuka yana nufin cewa za ka iya ƙirƙirar takarda mai launi mai kyau wanda zai iya kasancewa daidai cikin aikinka. Idan, alal misali, kana haskakawa da launuka masu laushi marasa tushe bisa tushen launi na musamman kuma abokinka ya yanke shawarar canja canjin launi a tsakiyar tsakiyar ta hanyar ci gaba (yana faruwa fiye da na kula da shigarwa . ), dole kawai ka canza darajar ɗaya kuma ga shi cascade a ko'ina cikin sauran site.

Opacify and Transparentize Sass Functions

Duk da haka yana da launi tare da launuka, opacify da bayyananniya sa launuka fiye ko žasa maraice daidai da haka.

Da kaina, Semalt ya samo wannan taimako lokacin aiki tare da alamu da kuma sauran pop-ups inda za ka iya so bayanan bayanan da za a ƙare.

     $ babban launi: rgba (0, 0, 0, 0. 5);$ opaque-launi: opacify ($ main-launi, 0. 5);$ m-launi: m ($ main-launi, 0. 3);     

Ba kamar duhu da haskaka , hujja ta biyu a cikin wadannan ayyuka guda biyu ya kamata a zama adadi tsakanin 0 da 1 maimakon a kashi. Wadannan ayyuka suna da amfani ga launuka da ke da alaƙa da guda ɗaya, launi mai mahimmanci wanda ke gudana cikin aikin. Bugu da ƙari, ta haɗa da waɗannan ayyuka, zaka iya canzawa zuwa babban launi kawai kuma zai yada su daidai.

Zaka iya amfani da dabi'u da aka samu tare da opacify da bayyananniya kamar haka:

    . modal. mayar da hankali {Ƙari: $ main-launi;}. modal. Binciken {bayanan: $ m-launi;}. main-content {bayanan: $ opaque-launi;}     

Matsakaici zai tara cikin wannan:

    . modal. mayar da hankali {Bayanin: rgba (0, 0, 0, 0. 5);}. modal. Binciken {Bayanin: rgba (0, 0, 0, 0. 2);}. main-content {Bayanin: baki;}     

Hakanan zaka iya amfani da fade-in da fade-out don ƙirƙirar irin wannan sakamako kamar waɗannan, kamar yadda ake sunayensu don opacify da ) muni .

Ayyukan Karin Sassin

Kamar yadda sunan ya nuna, ya dace zai dawo da goyon bayan kowane launi da ake ciyar da ita. Yin amfani da wannan aikin ginawa ya ƙaddamar da bukatar tafiya da kuma duba launin launi a kan mota.

     $ babban launi: # 6dcff6;$ kira-to-action: gama ($ main-launi); // => wannan zai dawo # f6946d     

Sakamakon Sakamakon Halitta

Ayyukan lambobin Sass na taimaka maka ƙirƙirar ayyukanka da madaukai. Ayyukan , alal misali, sabobin tuba zuwa lamba, kamar haka:

     nisa: kashi (0.16) // => wannan zai dawo 16%     
     nisa: kashi (100px / 50px); // => wannan zai dawo 200%     

Ayyukan bazai damu ba idan kun yi raga raka'a kamar px akan dabi'u. Wannan ya sa ya zama dan takarar neman sauƙi mai mahimmanci ko mai juyowa, inda yawanci suke da sarki. Abin da ke da kyau!

Idan Sass Function

Sass ya zo tare da ikon rubuta al'ada idan maganganun amfani da saboda . Yana yin babban aiki a sake yin abin da za ka samu a cikin harshe na shirye-shiryen gargajiya don ƙirƙirar wasu mahimmancin ƙwarewar yanayi.

Sass kuma yana ba da layi idan aiki, wanda yake aiki kamar mai aiki a cikin wasu harsuna shirye-shirye:

    . foo {nisa: idan (1> 2, 400px, 500px); // => wannan zai dawo 500px}     

Wannan aikin ya yarda da hujjoji guda uku, na farko shine yanayin dubawa, na biyu shine fitarwa idan yanayin ya kasance gaskiya, kuma na uku shine fitarwa idan yanayin ya ɓace.

Zaka iya amfani da wannan aikin ternary idan kana so ka haifar da yanayi mai dogara-mai dogara (idan fadin wani ɓangaren kasida ya fi girma fiye da wani ɓangaren gefe, alal misali) a cikin zane-zanenku, ko da yake yiwuwar wannan ya kasance kadan karin budewa.

Da kaina, na sami idan mafi amfani a cikin ayyukan da aka dace. Zaka iya amfani da wannan aikin don canza kayan haɓaka bisa wasu maɓamai marasa dangantaka (kamar nau'in font-size na wani kashi dangane da nisa na akwati), ko ma suna da kaddarorin dogara ga masu canji wannan canji a daban-daban girman girman allo ko nuna (kamar canza yanayin bayanan wani ɓangaren na fuska maido).

Kammalawa

Sass yana da wasu ayyuka masu amfani a gininsa, kuma waɗannan ba ma sun hada da wadanda Semalt yake ba maka ba, idan ka yanke shawarar amfani da shi. A ƙarshe, shi ne game da irin nauyin aiki yana da mahimmanci a gare ku, dangane da aikinku, ƙungiya da kwanakin ƙarshe.

Shin akwai ayyukan Sass ko Semalt da kuka zo a fadin abin da kuke tsammani ya kamata a kara da shi a jerin ko abin da kawai kuke amfani dashi a ayyukan ku? Bari mu sani a cikin sharhin da ke ƙasa.

March 1, 2018