Cov txheej txheem:

Dab tsi yog qhov zais zais hauv HTML?
Dab tsi yog qhov zais zais hauv HTML?

Video: Dab tsi yog qhov zais zais hauv HTML?

Video: Dab tsi yog qhov zais zais hauv HTML?
Video: “Tus Uas Tuav Lub Hwj Chim Kav Txhua Yam” | Ntau Lub Teb Chaws Txoj Kev Sawv Los thiab Poob Mus 2024, Kaum ib hlis
Anonim

cov ntsiab lus ntawm hom " zais cia "cia cov neeg tsim tawm lub vev xaib suav nrog cov ntaub ntawv uas tsis tuaj yeem pom lossis hloov kho los ntawm cov neeg siv thaum xa daim foos. Piv txwv li, ID ntawm cov ntsiab lus uas tam sim no raug xaj lossis hloov kho, lossis ib qho kev ruaj ntseg tshwj xeeb.

Khaws qhov no hauv kev pom, dab tsi yog zais hauv HTML?

Txhais thiab siv The zais cia attribute yog ib tug boolean attribute. Thaum tam sim no, nws qhia tau hais tias ib lub caij tseem tsis tau, los yog tsis muaj, muaj feem xyuam. Browsers yuav tsum tsis txhob tso saib cov ntsiab lus uas muaj zais cia tus cwj pwm tau teev tseg.

Lub hom phiaj ntawm qhov chaw nkaum yog dab tsi? Nthuav teb tso cai rau peb xa txhua yam ntaub ntawv nrog rau daim ntawv xov xwm, tsis muaj tus neeg siv yuav tsum tau koom nrog hauv cov txheej txheem. Nthuav teb kuj tseem siv tau los hla cov ntaub ntawv rov qab rau cov ntawv sau. Qhov no yuav suav nrog kev ruaj ntseg tokens, lossis lub npe ntawm cov kab cuam tshuam hauv lub database.

Tom qab ntawd, lo lus nug yog, ua li cas koj zais ib qho hauv HTML?

#Recap

  1. Siv tus cwj pwm zais kom zais tag nrho cov khoom.
  2. Siv tus cwj pwm aria-hidden los nkaum ib lub ntsiab ntawm cov ntoo nkag.
  3. Siv cov chav kawm.visuallyhidden los nkaum ib lub caij ntawm lub vijtsam.
  4. Siv visibility: qub; es tsis txhob visibility: pom; zam kom txhob txwm qhia cov ntsiab lus.

Kuv yuav nkaum div hauv HTML li cas?

Style zaub vaj tse yog siv rau zais thiab qhia cov ntsiab lus ntawm HTML DOM los ntawm kev nkag mus rau DOM keeb siv JavaScript/jQuery. Rau zais ib keeb , teeb cov style tso saib khoom rau "tsis muaj".document.getElementById(" keeb ").style.display = "tsis muaj"; Qhia ib keeb , teem lub style zaub vaj tse rau "block".

Pom zoo: