Yuav Ua Li Cas Kom Khawm Illumination

Cov txheej txheem:

Yuav Ua Li Cas Kom Khawm Illumination
Yuav Ua Li Cas Kom Khawm Illumination

Video: Yuav Ua Li Cas Kom Khawm Illumination

Video: Yuav Ua Li Cas Kom Khawm Illumination
Video: Xav Muaj Nyiaj Yuav Ua Li Cas ? 2024, Hlis ntuj nqeg
Anonim

Backlighting ntawm cov nyees khawm hauv cov nplooj ntawv web feem ntau yog txhim tsa siv ob daim duab. Thaum koj hover tus nas cursor dhau qhov sib thooj ntawm cov ntaub ntawv (txuas lossis khawm), ib qho xwm txheej tau tsim tawm, uas, raws li cov lus qhia sau hauv CSS cov lus, ua rau tus browser hloov ib qho rau lwm tus. Thaum tus nas cursor txav mus deb ntawm khawm, qhov hloov pauv sab nraud tshwm sim.

Yuav ua li cas kom khawm illumination
Yuav ua li cas kom khawm illumination

Tsim nyog

Cov txuj ci yooj yim ntawm HTML thiab CSS hom lus

Cov Lus Qhia

Kauj ruam 1

Muaj ntau ntau txoj kev xaiv rau kev siv xws lub tshuab kev ntsaws siab. Rau ib qho ntawm lawv, koj tuaj yeem siv tib HTML code, hloov tsuas yog txoj haujlwm tau piav qhia style. Daim HTML code ntawm lub pob yuav zoo li no: ntawv ntawm lub pob Ntawm no Ntawm no yog lub cim ntawm nplooj ntawv no (id = "btnA") uas cov lus piav qhia hom yuav txuas nrog.

Kauj ruam 2

Txhawm rau siv ib qho ntawm cov kev xaiv, koj yuav tsum npaj ob daim duab, ib qho yog cov qhia khawm nyob rau hauv lub xeev tsis ruaj khov, thiab qhov thib ob nrog lub teeb nraub qaum. Lawv yuav raug siv los ua cov duab keeb kwm ntawm qhov txuas. Cov lus qhia CSS rau lub khawm no yuav zoo li no:

a # btnA, a # btnA: mus saib {

tso saib: thaiv;

dav: 50px;

qhov siab: 20px;

tom qab: url (btnA.gif) tsis muaj-rov tso;

ciam teb: 0;

}

a # btnA: huj {

tom qab: url (btnA_hover.gif) tsis muaj rov ua dua;

ciam teb: 0;

}

Ntawm no, hauv thawj lub block, qhov ntev ntawm daim duab qhia lub pob yog qhia (dav: 50px; qhov siab: 20px;). Koj yuav tsum tau hloov lawv nrog qhov ntev ntawm koj daim duab. Cov npe ntawm cov ntaub ntawv duab yuav tsum tau hloov nyob rau hauv tib txoj kev: btnA.

Kauj ruam 3

Ib txoj hauv kev yog muab ob daim duab tso ua ib daim duab. Nws tuaj yeem yog ib qho tseem ceeb rau lwm tus, lossis nws tuaj yeem nyob ze ib leeg. Nws kuj tseem yuav raug siv ua keeb kwm yav dhau los rau qhov txuas. Txij li thaum khawm qhov ntau thiab tsawg tau teev nyob rau hauv khawm khawm cov lus piav qhia, txhua yam uas tsis haum rau lawv yuav tsis pom. Hauv qhov no, cov lus qhia tso rau hauv CSS cov lus piav qhia yuav tsum, thaum hovering tus nas cursor, kos cov duab keeb kwm yav dhau thiaj li tias thaj chaw nrog cov duab ntawm lub khawm highlighted poob rau hauv tus ncej. Rau qhov kev xaiv no, tus lej los ntawm kauj ruam dhau los yuav tsum tau hloov pauv raws li hauv qab no:

a # btnA, a # btnA: mus saib {

tso saib: thaiv;

dav: 50px;

qhov siab: 20px;

tom qab: url (btnA.gif) tsis muaj-rov tso;

ciam teb: 0;

}

a # btnA: huj {

tom qab: url (btnA.gif) tsis muaj-rov 21px;

ciam teb: 0;

}

Qhov no xav tias koj tau tso cov duab ib qho saum toj ib qho ntawm lwm qhov (raug sau rau hauv qab) thiab tau khaws cia rau hauv cov ntaub ntawv hu ua btnA.gif. Qhov siab ntawm cov nyees khawm yog 20px, qhov dav yog 50px - koj yuav tsum hloov cov nqi no nrog koj tus kheej.

Pom zoo: