Cov txheej txheem:

Koj siv flex li cas hauv CSS?
Koj siv flex li cas hauv CSS?

Video: Koj siv flex li cas hauv CSS?

Video: Koj siv flex li cas hauv CSS?
Video: Cia Vajtswv siv koj li nws lub siab nyiam: Thov Vaajtswv Ua Tug Coj by 2gether 2024, Kaum ib hlis
Anonim

Cov ntsiab lus

  1. Siv tso saib: ua flex ; tsim ib ua flex thawv.
  2. Siv justify-cov ntsiab lus los txhais cov kab rov tav kev sib dhos ntawm cov khoom.
  3. Siv align-cov khoom los txhais cov kab ntsug ntsug ntawm cov khoom.
  4. Siv flex -kev taw qhia yog tias koj xav tau kab tsis yog kab.
  5. Siv kab-rov qab los yog kab-rov qab qhov tseem ceeb los hloov cov khoom xaj.

Hais txog qhov no, dab tsi yog kev siv cov zaub flex hauv CSS?

A ua flex thawv nthuav tawm cov khoom kom sau muaj qhov chaw dawb lossis shrinks lawv kom tsis txhob dhau. Qhov tseem ceeb tshaj, cov flexbox ua layout yog kev taw qhia-agnostic as opposed to the li niaj zaus layouts (block uas yog vertically-based thiab inline uas yog kab rov tav-raws li).

Ib tug kuj yuav nug, CSS Flex 1 yog dab tsi? ua flex : 1 ; = ua flex : 1 1 0n;ua. (qhov twg n yog ib qhov ntev). ua flex -Grow: Tus lej qhia ntau npaum li cas cov khoom yuav loj hlob txheeb ze rau lwm cov khoom hloov tau. ua flex -shrink Ib tus lej qhia tias qhov khoom yuav txo qis npaum li cas txheeb ze rau cov khoom hloov tau yooj yim. ua flex -Basis Qhov ntev ntawm cov khoom.

Tom qab ntawd, ib tug kuj yuav nug, dab tsi yog inline Flex CSS?

Hauv kab - Flex - Cov hauv kab version ntawm ua flex tso cai rau lub caij, thiab nws yog menyuam yaus, muaj ua flex cov khoom thaum tseem tshuav nyob rau hauv qhov tsis tu ncua ntawm cov ntaub ntawv / lub vev xaib. Nws teb zoo li lub ntsiab thaiv, hais txog cov ntaub ntawv ntws. Ob flexbox ua ntim tsis tuaj yeem nyob ntawm tib kab yam tsis muaj ntau dhau styling.

Dab tsi yog qhov default orientation nyob rau hauv lub thawv Flex?

Cov ua ntej kev npaj tom qab siv cov zaub: ua flex yog rau cov khoom yuav tsum tau teem raws lub ntsiab axis ntawm sab laug mus rau sab xis. Cov animation hauv qab no qhia tias yuav ua li cas thaum twg ua flex - kev taw qhia : kab yog ntxiv rau lub thawv keeb. Koj tuaj yeem ua tau teem flex - kev taw qhia mus rau kab-rov qab thiab kab-rov qab.

Pom zoo: