Nws muaj ob hom kev xaib ntawm qhov chaw: tabular thiab block. Thiab thaum lub qub yooj yim dua rau kev tsim cov nplooj ntawv yooj yim ntawm html, qhov tom kawg yog qhov zoo dua yog tias koj xav tau ntxiv cov ntsiab lus ib leeg rau hauv daim ntawv ntawm cov ntawv.
Cov Lus Qhia
Kauj ruam 1
Muaj ob lub tswv yim uas yuav ua rau koj los txhim kho lub thaiv tsim koj tus kheej: los ntawm kev teeb tsa cov ntawv txheeb ua qauv rau hauv ib daim ntawv, lossis los ntawm sib txuas los ntawm cov khoom siv sab nraud. Ob qho muab tib lub txiaj ntsig, yog li tsis muaj qhov sib txawv nruab nrab ntawm lawv. Hauv thawj kis, muab cov cai hauv qab no rau txhua qhov chaw hauv cov ntaub ntawv style.css:
.block1 {
}
Block1 - lub npe ntawm lub block, koj tuaj yeem sau lwm yam. Nruab nrab ntawm curly kev zawm hniav, qhia meej cov kev txwv hauv cov qauv hauv qab no: ntaus nqi npe> hnyuv tws> tus nqi> semicolon (suav nrog tso ua ntej rau curly brace). Cov ntsiab lus hauv qab no feem ntau siv:
- qhov dav - qhov dav (500px, 100%, thiab lwm yam);
- qhov siab - qhov siab (200px, 25%, thiab lwm yam);
- keeb kwm yav dhau - xim tom qab (Daj, Liab, # 000000);
- padding - padding nyob ib ncig ntawm cov ntsiab lus sab hauv qhov block (0px, 20%);
- npoo - npoo ntawm sab nraud los ntawm qhov block (15px, 40%);
- ciam teb - thav duab (ciam teb: khoom 0px dub;);
- ntab - sib ncag (sab laug, xis);
- ciam teb-vojvoog - sib npaug ntawm cov ces kaum (ciam teb-vojvoog: 10px;).
Kauj ruam 2
Hauv kev siv thib ob ntawm CSS, ntxiv rau qhov sib txawv nruab nrab ntawm cov thiab cov cim npe:
.block1 {
}
Thiab ntxiv cov kev txwv koj xav tau.
Kauj ruam 3
Ntxig qhov thaiv rau hauv qhov chaw xav tau ntawm tus xaib siv cov lus txib:
Thaiv 1
Txuag thiab rov khoom nplooj ntawv, nws yuav tsum tshwm sim. Nco ntsoov tias qhov siab tuab sib txawv yuav txawv raws li cov ntsiab lus yog. Piv txwv li, yog tias koj tso 300px, tab sis tsuas yog sau ib kab ntawv ntawm kab lus, nws yuav tsis muab tso tawm kom tag. Qhov no tuaj yeem ua kom raug, piv txwv li, siv lub rooj nrog cov yuav tsum tau ua, uas yuav tsum tau muab tso rau sab hauv qhov thaiv, i.e. nruab nrab ntawm cov cim npe thiab. Thiab yog li hais tias tus ciam teb tsis tuaj yeem pom, ntxig rau tus cwj pwm