Brian
Brian

DivMagic washinze

Ku ya 12 Gicurasi 2023

Tailwind Imyitozo myiza - Ubuyobozi buhebuje bwa CSS Tailwind

Image 0

Mugihe cyo gushyira mubikorwa CSS yambere-yambere, Tailwind CSS yahindutse igisubizo kubateza imbere benshi.

Guhindura, gutanga umusaruro, no koroshya imikoreshereze itanga byagaragaye ko ari ntangarugero mugutezimbere urubuga rugezweho.

Ariko, nkigikoresho icyo aricyo cyose, kugirango ubone byinshi muri byo, ni ngombwa gusobanukirwa no gushyira mubikorwa Tailwind CSS.

Reka twibire muri bumwe muri ubwo buhanga.

1. Ibyingenzi-Shingiro

Filozofiya yingirakamaro-yambere ni ihame shingiro rya Tailwind CSS, igamije guha imbaraga abitezimbere bafite ibyiciro byo hasi byingirakamaro aho kuba byateguwe mbere. Ubu buryo bushobora kubanza kugaragara nkubwoba bitewe nuburiganya bwa HTML yawe; icyakora, iyo bimaze gusobanuka, itanga prototyping yihuse hamwe nu musaruro-urwego rwo kwihitiramo.

Mubyingenzi-byambere byubaka, buri cyiciro gihuye nuburyo bwihariye bwimiterere. Kurugero, umwandiko-wo hagati urwego ruzahuza inyandiko yawe hagati, mugihe bg-ubururu-500 izaha element yawe igicucu cyihariye cyubururu.

Ubu buryo buteza imbere ibice bikoreshwa kandi bikagabanya umubare wa CSS wanditse, ukuraho ibibazo bisanzwe nkintambara zihariye no kurandura kode yapfuye.

2. Igishushanyo mbonera

Tailwind CSS nayo irusha abandi gushushanya. Ikoresha mobile-yambere ya sisitemu ya sisitemu, bivuze uburyo bukoreshwa kuri ecran ntoya irashobora kworoha cyane kuri nini. Ibi birashobora gukorwa ukoresheje prefixes yoroshye nka sm:, md:, lg:, na xl: mbere yamasomo yawe yingirakamaro.

Kurugero, md: inyandiko-hagati izakoresha gusa inyandiko-hagati yicyiciro hagati na nini ya ecran. Ibi biragufasha gukora igishushanyo mbonera kubunini bwa ecran zitandukanye, gukora igishushanyo mbonera cyumuyaga hamwe na Tailwind.

3. Gukoresha uburyo

Mugihe ibikorwa-byambere bishishikariza gukoresha uburyo butaziguye kuri HTML yawe, gusubiramo ibintu bigoye byingirakamaro birashobora kuba ingorabahizi. Hano, amabwiriza ya Tailwind ya @apply ahinduka umukiza, akwemerera gukuramo uburyo bwisubiramo mumasomo yihariye ya CSS.

Kurugero, niba ukoresha kenshi guhuza bg-umutuku-500 inyandiko-yera p-6, urashobora gukora urwego rushya nka .error hanyuma ugakoresha @apply kugirango ukoreshe ubu buryo. Ibi byongera kode isomeka kandi ikomeza.

4. Ongeraho Imiterere yihariye

Nubwo Tailwind CSS ije ifite umurongo mugari wibyiciro byingirakamaro, urashobora gukenera uburyo bwihariye kubisabwa byihariye. Tailwind itanga amahitamo menshi yo kwihitiramo binyuze muri dosiye iboneza, tailwind.config.js.

Urashobora kwagura iboneza risanzwe, kurema amabara yihariye, gucamo, imyandikire, nibindi byinshi. Ni ngombwa, ariko, gukoresha iyi mikorere gake kugirango wirinde kubyimba dosiye yawe.

5. Imikorere & Amabwiriza

Tailwind CSS itanga imikorere nubuyobozi kugirango uburambe bwiterambere bwawe bworohe. Kurugero, insanganyamatsiko () imikorere igufasha kubona indangagaciro zawe muburyo butaziguye muri CSS yawe, byorohereza stiling.

Byongeye kandi, amabwiriza ya Tailwind, nka @kudasubiza, @variants, na @apply, agufasha kubyara ibisubizo, ibisubizo bya leta, kandi ugakuramo uburyo bwasubiwemo. Gukoresha iyi mikorere nubuyobozi bikwiye bizihutisha iterambere ryanyu kandi ukomeze codebase yawe.

6. Gukemura Hover, Kwibanda, nibindi bihugu

Ahandi hantu Tailwind CSS irabagirana ikora ibintu bitandukanye. Gukoresha uburyo kuri hover, kwibanda, gukora, nibindi bihugu biroroshye nko kubanziriza urwego rwingirakamaro hamwe nizina rya leta.

Kurugero, hover: bg-ubururu-500 bizashyira mubikorwa bg-ubururu-500 mugihe ikintu kizengurutse hejuru. Izi prefixes zitanga urwego rwo hejuru rwo kugenzura uburyo ibintu bitwara muri leta zitandukanye, bizamura uburambe bwabakoresha kurubuga rwawe.

Mugusoza, kumenya neza Tailwind CSS imikorere myiza irashobora kuzamura cyane inzira yiterambere ryurubuga. Uburyo bwambere-bwambere, iyo buhujwe no gukoresha neza uburyo, imiterere, hamwe nintoki

Kunoza akazi kawe ka Tailwind CSS hamwe na DivMagic

Niba ushaka kunoza akazi kawe ka Tailwind CSS, reba DivMagic, umugereka wa mushakisha igufasha gukoporora no guhindura amasomo ya Tailwind CSS uhereye kuri mushakisha yawe kandi ikora kurubuga urwo arirwo rwose.

Chrome:Shyira kuri Chrome

Kubona ibitekerezo cyangwa ikibazo? Tumenyeshe kurubuga rwacu, kandi ibisigaye tuzabikora!

Urashaka gukomeza kugezwaho amakuru?

Injira kurutonde rwa imeri ya DivMagic!

© 2024 DivMagic, Inc. Uburenganzira bwose burasubitswe.