Tus menyuam hauv CSS yog dab tsi?
Tus menyuam hauv CSS yog dab tsi?

Video: Tus menyuam hauv CSS yog dab tsi?

Video: Tus menyuam hauv CSS yog dab tsi?
Video: lub hom phiaj loj tshaj plaws ntawm kev ntseeg yog dab tsi 2024, Kaum ib hlis
Anonim

CSS Me Nyuam vs Descendant selectors. Me nyuam Xaiv: Me nyuam Selector yog siv los phim tag nrho cov ntsiab lus uas yog tus menyuam ntawm ib lub ntsiab lus. Nws muab kev sib raug zoo ntawm ob lub ntsiab lus. Tus operand nyob rau sab laug ntawm > yog niam txiv thiab tus operand ntawm sab xis yog tus menyuam keeb.

Tib neeg kuj nug, lub ntsiab lus ntawm CSS yog dab tsi?

CSS . Stands rau "Cascading Style Sheet." Cascading style nplooj ntawv yog siv los tsim qhov layout ntawm nplooj ntawv Web. Lawv tuaj yeem siv los txhais cov ntawv sau, qhov loj me ntawm lub rooj, thiab lwm yam ntawm nplooj ntawv Web uas yav dhau los tsuas yog txhais tau hauv nplooj ntawv HTML.

Ib sab saum toj no, kuv yuav siv tus menyuam kawg hauv CSS li cas? CSS:nth-last-child() Selector

  1. Qhia meej xim tom qab rau txhua tus

    yam uas yog tus menyuam thib ob ntawm nws niam nws txiv, suav los ntawm tus menyuam kawg: p:nth-kawg-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.
  3. Siv tus qauv (an + b).

Hais txog qhov no, koj txhais li cas nth tus menyuam hauv CSS?

: nth - tus menyuam . Qhov: nth - tus menyuam selector tso cai rau koj xaiv ib lossis ntau lub ntsiab lus raws li lawv qhov kev txiav txim, raws li tus qauv. Nws yog txhais hauv CSS Selectors Level 3 spec as a "structural pseudo-class", lub ntsiab lus nws yog siv los tsim cov ntsiab lus raws li nws txoj kev sib raug zoo nrog niam txiv thiab kwv tij txheeb ze.

Vim li cas thiaj siv hauv CSS?

CSS selectors yog siv mus "nrhiav" (los yog xaiv) cov ntsiab lus HTML koj xav kom style. Pseudo-elements selectors (xaiv thiab style ib feem ntawm cov khoom) Tus cwj pwm xaiv (xaiv cov ntsiab lus raws li tus cwj pwm lossis tus cwj pwm tus nqi)

Pom zoo: