Cascading style sheet yog siv los sau cov ntsiab lus ntawm nplooj ntawv HTML. Raws li, tag nrho cov lus txib siv hauv CSS yog tswj los kho cov tsos ntawm tej yam ntawm daim ntawv HTML.
Nws yog qhov tsim nyog
Lub khoos phis tawj muaj qhov txuas nrog
Cov Lus Qhia
Kauj ruam 1
Nyeem txog seb cov ntawv txheeb ua cascading zoo li cas siv. Cov ntawv luam tawm yog cov feem ntau siv ntau tshaj plaws ntawm cascading style ntawv. Txhua cov ntaub ntawv HTML muaj qhov ntau npaum li cas ntawm cov ntawv qhia hauv nws ntau ntu. Nyob rau tib lub sijhawm, txhua ntu ntawm nplooj ntawv yuav tsum muaj nws tus kheej hom ntawv thiab font: ib feem ntawm cov ntawv yog cov ntawv ntawm cov ntawv qhia zaub mov, lwm qhov yog lub npe, tus thib peb yog cov ntawv tseem ceeb ntawm nplooj ntawv, thiab lwm yam. Txhawm rau sau cov ntawv cov lus, cov lus txib yog siv los hloov lub npe ntawm tus font, nws qhov loj me, qhov hnyav, thiab lwm yam.
Kauj ruam 2
Yog li, ua ntej txhua yam, daim ntawv ceeb toom font-family style parameter. Cov cwj pwm no tso cai rau koj los tsim ib hom ntawv tshwj xeeb rau cov cim no. Lub npe ntawm tus qauv yog sau tom qab kos npe: ". Font-size style attribute yog siv los teeb qhov loj ntawm cov ntawv sau rau hauv lossis. Qhov loj me me kuj tseem sau tom qab ": "kos npe thiab qhia hauv pixels, piv txwv li," font-size: 20px ".
Kauj ruam 3
Nco ntsoov tias cov lus sib dhos tau muab sib txuas thiab sau ua ke uas siv tus cim “;”. Qhov no muaj txiaj ntsig yog tias koj xav tau teeb tsa ntau yam rau ib lub cim npe.
Kauj ruam 4
Siv cov style ntaus nqi xim kom hloov xim ntawm cov ntawv. Lub npe xim tau sau nyob hauv tus qauv: ntsuab, xiav, liab, thiab lwm yam. Nws kuj tseem muaj peev xwm teeb tsa cov xim tsis tsuas yog cov ntawv nws tus kheej, tab sis kuj tseem muaj xim tom qab. Rau lub hom phiaj no, tom qab-xim cwj pwm yog siv, tom qab ntawd cov xim raug xaiv yuav tsum tau qhia. Yog tias koj xav siv duab, tsis yog sau, raws li keeb kwm yav dhau los hauv thaj chaw ntawm daim phiaj no, tom qab ntawd saib mus rau tom qab-cov duab style parameter, hais kom meej tom qab nws qhov chaw ntawm cov duab.
Kauj ruam 5
Ua kom paub tus lej ntawm cov cim cwj pwm uas teeb tsa cov kev txwv ntawm cov nplooj ntawv, uas, ua ntej ntawm txhua yam, suav nrog padding, ciam teb, ntab, txoj haujlwm.
Kauj Ruam 6
Siv padding parameter kom teev tus nqi ntawm cov npoo uas tau khi rau cov muab cim npe. Hauv qhov xwm txheej no, tus nqi no raug suav los ntawm txhua sab. Qhia txog ciam teb tus cwj pwm los tsim ciam teb ntawm daim teb no. Tom qab cov nyuv, qhov dav ntawm tus ciam yog sau ua pixels. Cov cuab yeej ntab yuav tso cai rau ib qho ntawm koj nplooj ntawv rau ntab rau sab xis lossis sab laug. Hauv qhov no, cov tsis tsim nyog ntawm cov cuab yeej no yog sab laug lossis txoj cai.
Kauj Ruam 7
Yog tias koj xav tau kom ncaj qha rau ib qho khoom ntawm daim ntawv, siv cov khoom ntiag tug. Nws nrhiav cov nplooj ntawv txuas mus rau qhov tsis muaj tseeb, xws li "txoj haujlwm: tsis raug; hauv qab: 50px; txoj cai: 10px;", lossis hauv txoj kev sib txheeb, raws li qhov kev ncua deb ntawm cov npoo ntawm nplooj.