CSS yog cascading style ntawv, uas yog cov lus rau piav qhia txog qhov pom ntawm nplooj ntawv nplooj. Ib qho ntawm qhov tseem ceeb ntawm CSS yog lub peev xwm los hloov cov lus teeb rooj nrog teeb tsa kab.
Nws yog qhov tsim nyog
HTML code editor
Cov Lus Qhia
Kauj ruam 1
Tsim thawj lub block. Hauv HTML daim ntawv, nws yuav zoo li div div nrog id 'block01'. Ntawm no, cov npe block01 qhia tias hauv CSS cov lus piav qhia, tag nrho cov khoom ntawm lub block no tau teev tseg rau tus xaiv # block01.
Kauj ruam 2
Qhia txog qhov thaiv hauv CSS. Hauv cov cwj pwm CSS, qhia lub npe ntawm tus cim (# block01) thiab hauv kev nkhaus piav qhia nws cov ciaj ciam - qhov dav, qhov chaw, qhov pab txhawb, xim tom qab. Piv txwv li, nws yuav zoo li qhov no: # block01 {dav: 150px; qhov siab: 150px; txoj hauj lwm: txog; saum: 0px; laug: 0px; xim tom qab: liab dawb}. Cov lus piav qhia no suav tias lub npov yuav yog 150 pixels ntev thiab 150 pixels dav, nws yuav nruj zoo rau hauv lub kaum sab sauv sab sauv ntawm daim ntawv, thiab nws cov keeb kwm yuav xim liab dawb.
Kauj ruam 3
Muab qhov thaiv tus kwv tij tso rau. Yog tias koj siv tsis tsis, tab sis tus txheeb ze muab tso rau hauv CSS cov lus piav qhia, tom qab ntawd koj tuaj yeem tso cov block tsis nrog txhav txhav mus rau ntawm daim phiaj ntawm kev sib koom tes, tab sis txheeb ze rau lwm cov twb muaj lawm. Txhawm rau ua qhov no, hloov txoj cai txoj hauj lwm: meej; saum: 0px; sab laug: 0px los ntawm txoj haujlwm: txheeb ze; sab saum toj: 200px; sab laug: 100px.
Kauj ruam 4
Muab qhov thaiv ncig. Hauv CSS, kab lus ciam teb-kab lus qhia yog lub luag haujlwm rau qhov no. Ntxiv cov lej hauv qab no rau koj cov stylesheet: ciam teb-vojvoog: 8px. Lub block yuav tam sim no muaj cov fab fab. Yog tias koj tsuas xav ua puag ncig qee lub kaum pob zeb, piav qhia txog lub vojvoog nyias rau ib leeg: ciam teb-ciam teb: 8px 8px 0px 0px.
Kauj ruam 5
Muab qhov thaiv kom txhob mob stroke. Txhawm rau nthuav tawm cov ntsiab lus ntawm thaiv nrog kab nyias, ntxiv cov cai hauv qab no rau nws cov CSS cov lus piav qhia: ciam teb sab saum toj: 1px dashed dub. Qhov kev qhia no txhais tau hais tias tus ciam teb ntawm lub block yuav dub thiab yuav yog ib pixel hauv thickness. Hauv qhov no, kis kab nws tus kheej yuav tshwm ua kab kab (dashed - kab dotted, dotted - dots, solid - line solid).
Kauj Ruam 6
Teeb cov yam ntxwv ntxiv rau. Qhia meej rau hauv CSS cov lus piav qhia dab tsi typeface yuav tsum siv rau cov ntawv hauv lub nris, dab tsi yuav tsum yog qhov loj me, kev teeb tsa thiab indentation los ntawm cov npoo ntawm qhov block. Cov yam ntxwv no tau piav qhia nyob hauv cov lus txhais font-family, font-loj, me-ntawv-kab, thiab padding.
Kauj Ruam 7
Koj tuaj yeem siv cov cuab yeej ntab rau txhawm rau txhawm rau ntws ntawm ib ntu ntawm lwm qhov. Yog tias koj tso nws mus rau “sab laug”, tom qab ntawd cov ntsiab lus yuav ntws ncig lub block ntawm sab laug, thiab “xis” - nyob sab xis. Yog tias koj teev lub nqi ntab li “tsis muaj”, lub tsev kawm ntawm lub block yuav tsis teeb tsa. Cov cuab yeej tseeb hauv CSS tiv thaiv qhov thaiv tsis txhob ntws mus rau sab xis, sab laug, lossis ob sab, thiab thim cov lus tshaj tawm.