Cov txheej txheem:

Koj siv thawj hom li cas?
Koj siv thawj hom li cas?

Video: Koj siv thawj hom li cas?

Video: Koj siv thawj hom li cas?
Video: Cia Vajtswv siv koj li nws lub siab nyiam: Thov Vaajtswv Ua Tug Coj by 2gether 2024, Tej zaum
Anonim

: thawj hom . Qhov: thawj hom selector hauv CSS tso cai rau koj los tsom rau qhov ua ntej tshwm sim ntawm ib yam khoom nyob rau hauv nws lub thawv. Nws tau txhais nyob rau hauv CSS Selectors Theem 3 spec raws li "cov qauv pseudo-chav kawm", txhais tau tias nws yog siv kom style cov ntsiab lus raws li nws txoj kev sib raug zoo nrog niam txiv thiab kwv tij cov ntsiab lus.

Ntawm no, dab tsi yog xaiv los ntawm selector seem P thawj hom?

Qhov: thawj hom pseudo-class xaiv cov thawj lub ntsiab ntawm nws hom (div, p , thiab lwm yam). Siv ib chav kawm xaiv (los yog a hom xaiv ) nrog cov pseudo-chav kawm txhais tau tias xaiv ib keeb yog tias nws muaj chav kawm (los yog ntawm qhov muab hom ) thiab yog ua ntej ntawm nws hom ntawm nws cov kwv tij.

Kuj Paub, qhov txawv ntawm tus nth ntawm hom () thiab Nth tus me nyuam () selectors? Cov nth-of-type() pseudo-class, zoo li tus me nyuam () , yog siv los phim ib qho khoom raws li tus lej. Tus lej no, txawm li cas los xij, sawv cev rau lub luag haujlwm txoj haujlwm hauv tsuas yog cov ntawm nws cov kwv tij uas yog tib yam hom.

Ib yam li ntawd, koj xaiv thawj tus menyuam hauv CSS li cas?

Yog koj xav tau xaiv thiab style ua ntej kab lus hauv ib lub thawv, seb nws puas yog thawj tus menyuam , koj tuaj yeem siv cov khoom siv: ua ntej -of-type selector, uas, raws li lub npe qhia, yuav xaiv thawj lub ntsiab ntawm nws hom, seb nws yog tus thawj tus menyuam ntawm nws niam nws txiv.

Koj xaiv qhov nth element hauv CSS li cas?

CSS:nth-child() Selector

  1. Qhia meej xim tom qab rau txhua tus

    yam uas yog tus menyuam thib ob ntawm nws niam nws txiv: p:nth-child(2) {

  2. Khib thiab txawm yog lo lus tseem ceeb uas yuav siv tau kom phim cov me nyuam cov ntsiab lus uas nws qhov Performance index yog khib los yog txawm (qhov Performance index ntawm thawj tus me nyuam yog 1).
  3. Siv tus qauv (an + b).

Pom zoo: