Cov tom qab ntawm lub vev xaib tuaj yeem raug khi rau nws cov ntsiab lus lossis coj tus kheej ntawm nws. Hauv thawj kis, thaum scrolling cov ntsiab lus hauv qhov browser browser, cov duab keeb kwm yav dhau los kuj tseem yuav nqes mus, thaum nyob hauv ob, nws tuaj yeem nyob ruaj ruaj. Txhawm rau siv lub ntsej muag nplooj ntawv txheeb yav dhau los, koj yuav tsum siv CSS cov lus piav qhia hom lus - tsuas yog nws tuaj yeem lav qhov qub tom qab tus cwj pwm hauv ntau hom browsers.
Cov Lus Qhia
Kauj ruam 1
Siv cov keeb kwm yav dhau los-txuas cov cuab yeej hauv CSS txhawm rau txheeb xyuas seb nplooj ntawv tom qab yuav tsum tau kho los yog txav mus. Nyob rau hauv tag nrho, cov cuab yeej no tuaj yeem muaj peb qhov tseem ceeb - yog tias koj tsis qhia meej ib qho ntawm lawv, tom qab ntawd los ntawm kev teeb tsa keeb kwm yav dhau los-txiav txim siab txiav txim siab tias yog scroll. Nrog tus nqi no, cov duab keeb kwm yav dhau scrolls nrog rau cov nplooj ntawv ntsiab lus. Cov qub txeeg qub teg nqi luam qhov keeb kwm yav dhau tus cwj pwm ntawm leej niam leej txiv, thiab tus nqi tas li ua rau cov duab keeb kwm yav dhau los ywj siab ntawm cov ntsiab lus - nws nyob qis qis thaum nplooj ntawv yog scrolled. Koj yuav tsum siv nws.
Kauj ruam 2
Npaj koj cov lus qhia CSS rau kev siv hauv cov nplooj ntawv koj xav kho tom qab. Yog tias koj yuav tsis tso CSS daim ntawv tso rau hauv ib daim ntawv qhia sab nrauv cov qauv qhia, tom qab ntawv cov lus qhia no yuav tsum muab tso nruab nrab ntawm qhov qhib thiab kaw cov cim style:
// yuav muaj lus piav qhia ntawm cov qauv
Cov lus piav qhia txog nplooj ntawv tom qab tus cwj pwm yuav tsum tau khi rau BODY keeb kwm - hauv CSS cov ntsiab lus nws yuav raug hu ua "xaiv" thiab yuav sau zoo li no: BODY {
// kev piav qhia ntawm nplooj ntawv lub cev yuav nyob ntawm no
} Cov khoom uas muaj feem rau qhov xaiv no yuav tsum tso rau hauv qhov nkhaus nkhaus, sib cais los ntawm cov xov paj: BODY {
Symptoms keeb kwm yav dhau: tsau;
duab tom qab: url (cov duab / BG.gif);
} Tus thawj kab khaws lub keeb kwm yav dhau daim duab, thiab kab thib ob qhia qhov chaw nyob ntawm cov ntawv uas muaj cov duab keeb kwm yav dhau, ntsig txog nplooj ntawv chaw nyob. Ob kab no tuaj yeem sau ua ke hauv ib kab lus CSS cov lus zoo li no: tom qab: url (cov duab / BG.gif) tsau;
Kauj ruam 3
Khaws tag nrho cov cai los kho keeb kwm yav dhau los rau hauv cov ntawv ntawm nplooj. Nyob hauv nws daim foos tiav, nws yuav zoo li no:
CEV {tom qab: url (cov duab / BG.gif) tsau;}
Tau kawg, koj yuav tsum tau hloov chaw thiab npe ntawm cov duab tom qab. Nws yog qhov zoo dua los tso qhov chaws ua ntej daim pib, txawm hais tias qhov no tsis yog qhov yuav tsum tau ua ua ntej.