Zikafika pakukhazikitsa CSS yoyamba, Tailwind CSS yakhala yankho lothandizira ambiri opanga.
Kusinthasintha, zokolola, komanso kugwiritsa ntchito mosavuta zomwe amapereka kwatsimikizira kuti ndizofunikira kwambiri pakukula kwamakono kwa intaneti.
Komabe, monga chida chilichonse, kuti mupindule nazo, ndikofunikira kumvetsetsa ndikugwiritsa ntchito njira zabwino za Tailwind CSS.
Tiyeni tilowe mu zina mwa njira zimenezi.
Utility-filosofi yoyamba ndiye mfundo yayikulu ya Tailwind CSS, yomwe cholinga chake ndi kupatsa mphamvu opanga magalasi ocheperako m'malo mwa zida zomwe zidapangidwira kale. Njira imeneyi poyamba ingawoneke yovuta chifukwa cha verbosity ya HTML yanu; komabe, ikamvetsetseka, imathandizira kufananiza mwachangu komanso kupanga masinthidwe apamwamba.
Muzomangamanga zoyambirira, kalasi iliyonse imagwirizana ndi mawonekedwe ake. Mwachitsanzo, kalasi yapakati-mawu imagwirizanitsa mawu anu pakati, pomwe bg-blue-500 ipatsa chinthu chanu mtundu wamtundu wabuluu.
Njirayi imalimbikitsa kusinthika kwa chigawocho ndikuchepetsa kuchuluka kwa CSS yomwe mumalemba, kuchotsa zinthu zomwe zimafala ngati nkhondo zenizeni komanso kuchotseratu ma code akufa.
Tailwind CSS imapambananso pamapangidwe omvera. Imagwiritsa ntchito makina oyambira mafoni, kutanthauza kuti masitayilo omwe amagwiritsidwa ntchito pazithunzi zing'onozing'ono amatha kugwera zazikulu. Izi zitha kuchitika pogwiritsa ntchito ma prefixes osavuta monga sm:, md:, lg:, ndi xl: musanayambe makalasi anu othandizira.
Mwachitsanzo, md:text-center ingogwiritsa ntchito kalasi yapakati pazithunzi pazapakati ndi zazikulu. Izi zimakupatsani mwayi wopangira masaizi osiyanasiyana azithunzi, ndikupanga mawonekedwe omvera kukhala kamphepo ndi Tailwind.
Ngakhale zofunikira-zoyamba zimalimbikitsa kugwiritsa ntchito masitayelo mwachindunji ku HTML yanu, kubwereza kuphatikiza kwazinthu zovuta kumatha kukhala kovuta. Apa, Tailwind's @apply malangizo amakhala opulumutsa moyo, kukulolani kuti muchotse masitayelo obwerezabwereza m'makalasi a CSS.
Mwachitsanzo, ngati mumakonda kugwiritsa ntchito bg-red-500 text-white p-6, mutha kupanga kalasi yatsopano ngati .error ndikugwiritsa ntchito @apply kuti mugwiritsenso ntchito masitayelo awa. Izi zimakulitsa kuwerengeka kwa ma code komanso kusakhazikika.
Ngakhale Tailwind CSS imabwera ndi makalasi osiyanasiyana othandizira, mungafunike masitayelo achikhalidwe pazofunikira zinazake. Tailwind imapereka zosankha zambiri mwamakonda kudzera mufayilo yake yosinthira, tailwind.config.js.
Mutha kukulitsa masinthidwe osasinthika, kupanga mitundu yokhazikika, ma breakpoints, mafonti, ndi zina zambiri. Ndikofunikira, komabe, kugwiritsa ntchito gawoli pang'onopang'ono kuti musatseke fayilo yanu yosinthira.
Tailwind CSS imapereka ntchito zingapo ndi malangizo kuti chitukuko chanu chikhale chosavuta. Mwachitsanzo, mutu () ntchito imakupatsani mwayi wofikira masinthidwe anu mwachindunji mu CSS yanu, ndikuwongolera makongoletsedwe amphamvu.
Kuphatikiza apo, malangizo a Tailwind, monga @responsive, @variants, ndi @apply, amakulolani kuti mupange zomvera, zosiyanasiyana za boma, ndikuchotsa masitaelo obwerezabwereza, motsatana. Kugwiritsa ntchito izi ndi malangizo moyenera kudzafulumizitsa chitukuko chanu ndikusunga codebase yanu mwadongosolo.
Dera lina lomwe Tailwind CSS imawala ndikusamalira zigawo zosiyanasiyana. Kuyika masitayelo pa hover, focus, active, ndi madera ena ndikosavuta monga kulemberatu gulu lothandizira ndi dzina la boma.
Mwachitsanzo, hover:bg-blue-500 idzagwiritsa ntchito kalasi ya bg-blue-500 pamene chinthucho chikugwedezeka. Ma prefixes awa amapereka kuwongolera kwakukulu pa momwe zinthu zimayendera m'maiko osiyanasiyana, kukulitsa luso la ogwiritsa ntchito patsamba lanu.
Pomaliza, kudziwa bwino izi za Tailwind CSS kumatha kupititsa patsogolo njira yanu yopangira ukonde. Njira yothandiza-yoyamba, ikaphatikizidwa ndikugwiritsanso ntchito masitayelo, makonda, ndi manja abwino
Ngati mukufuna kukonza kayendedwe ka Tailwind CSS yanu, onani DivMagic, chowonjezera chamsakatuli chomwe chimakulolani kukopera ndikusintha makalasi a Tailwind CSS mwachindunji kuchokera pa msakatuli wanu ndipo imagwira ntchito patsamba lililonse.
Khalani oyamba kudziwa za nkhani, zatsopano ndi zina zambiri!
Chotsani kulembetsa nthawi iliyonse. Palibe sipamu.
© 2024 DivMagic, Inc. Ufulu wonse ndi wotetezedwa.