Qalisa kabusha
Qalisa kabusha, iqoqo lezinguquko ze-CSS zesici esithile efayeleni elilodwa, qala i-Bootstrap ukuze unikeze isisekelo esihle, esingaguquki, nesilula ongakhela phezu kwaso.
Indlela
Qalisa kabusha yakhela phezu kwe-Nomalise, ihlinzeka ngezinto eziningi ze-HTML ezinezitayela ezicatshangelwe imibono ethile usebenzisa izikhethi zezinto kuphela. Isitayela esengeziwe senziwa kuphela ngamakilasi. Isibonelo, siqalisa kabusha ezinye <table>
izitayela ukuze sithole isisekelo esilula futhi kamuva sinikeze .table
, .table-bordered
, nokuningi.
Nansi imihlahlandlela yethu nezizathu zokukhetha ukuthi yini ongayibhala ekuqaliseni kabusha:
- Buyekeza amanani amisiwe esiphequluli ukuze uwasebenzise u
rem
-s esikhundleni sika-em
s ukuze uthole izikhala zezingxenye ezingakala. - Gwema
margin-top
. Amamajini aqondile angawa, aveze imiphumela engalindelekile. Okubaluleke nakakhulu, isiqondiso esisodwamargin
siyimodeli yengqondo elula. - Ukuze kube lula ukukala kuwo wonke amasayizi wedivayisi, ama-elementi ebhulokhi kufanele asebenzise
rem
u-s ku-margin
s. - Gcina izimemezelo
font
zezakhiwo ezihlobene zibe zincane, usebenzisainherit
noma nini lapho kunokwenzeka.
Okuzenzakalelayo kwekhasi
Ama- elementi <html>
kanye nama - <body>
elementi abuyekeziwe ukuze anikeze okuzenzakalelayo okungcono ekhasini lonke. Ngokuqondile:
- I
box-sizing
-elementi isethwe emhlabeni wonke kuwo wonke ama-elementi—kuhlanganise*::before
futhi*::after
, kuya ku-border-box
. Lokhu kuqinisekisa ukuthi ububanzi obushiwo be-elementi abulokothi budlulwe ngenxa yokupheda noma umngcele.- Asikho isisekelo
font-size
esimenyezelwe ku-<html>
, kodwa16px
kuyacatshangelwa (okuzenzakalelayo kwesiphequluli).font-size: 1rem
isetshenziswa kuhlelo<body>
lokukala uhlobo oluphendulayo olulula ngemibuzo yemidiya ngenkathi ihlonishwa izintandokazi zabasebenzisi futhi iqinisekisa indlela efinyeleleka kakhudlwana.
- Asikho isisekelo
- I
<body>
futhi isetha umhlaba wonkefont-family
,line-height
, kanyetext-align
. Lokhu kuzuzwa njengefa kamuva ezinye izici zefomu ukuvimbela ukungqubuzana kwefonti. - Ukuze uvikeleke, i- inesimemezelo
<body>
esimisiwebackground-color
, esishintshashintshayo sithi#fff
.
Isitaki sefonti yomdabu
Amafonti ewebhu azenzakalelayo (i-Helvetica Neue, i-Helvetica, ne-Arial) ehlisiwe ku-Bootstrap 4 futhi kwathathelwa indawo “isitaki sefonti yomdabu” ukuze kusetshenziswe umbhalo ophelele kuwo wonke amadivayisi ne-OS. Funda kabanzi mayelana nezitaki zefonti zomdabu kulesi sihloko se - Smashing Magazine .
Lokhu font-family
kusetshenziselwa <body>
futhi kuzuzwe njengefa ngokuzenzakalelayo emhlabeni wonke kuyo yonke i-Bootstrap. Ukuze ushintshe okomhlaba font-family
, buyekeza $font-family-base
uphinde uhlanganise i-Bootstrap.
Izihloko nezigaba
Zonke izakhi zesihloko—isb, <h1>
—futhi zisethwa <p>
kabusha ukuze margin-top
zisuswe. Izihloko margin-bottom: .5rem
zengeziwe kanye nezigaba margin-bottom: 1rem
ukuze kube lula ukuhlukanisa.
Isihloko | Isibonelo |
---|---|
|
h1. Isihloko se-Bootstrap |
|
h2. Isihloko se-Bootstrap |
|
h3. Isihloko se-Bootstrap |
|
h4. Isihloko se-Bootstrap |
|
h5. Isihloko se-Bootstrap |
|
h6. Isihloko se-Bootstrap |
Uhlu
Zonke izinhlu— <ul>
, <ol>
, kanye <dl>
— zisusiwe margin-top
futhi a margin-bottom: 1rem
. Uhlu olufakiwe alunazo margin-bottom
.
- Lorem ipsum dolor sit amet
- I-Consectetur adipiscing elit
- Integer molestie lorem kanye ne-massa
- I-Facilisis ku-pretium nisl aliquet
- I-Nulla volutpat aliquam velit
- I-Phasellus iaculis neque
- I-Purus sodales ultricies
- I-Vestibulum laoreet porttitor sem
- Ac tristique libero volutpat at
- I-Faucibus porta lacus fringilla vel
- Aenean sit amet erat nunc
- Thola i-porttitor lorem
- Lorem ipsum dolor sit amet
- I-Consectetur adipiscing elit
- Integer molestie lorem kanye ne-massa
- I-Facilisis ku-pretium nisl aliquet
- I-Nulla volutpat aliquam velit
- I-Faucibus porta lacus fringilla vel
- Aenean sit amet erat nunc
- Thola i-porttitor lorem
Ukuze uthole isitayela esilula, isigaba esicacile, nezikhala ezingcono, izinhlu zezincazelo zibuyekeziwe margin
s. <dd>
s setha kabusha margin-left
futhi 0
wengeze margin-bottom: .5rem
. <dt>
s banesibindi .
- Uhlu lwezincazelo
- Uhlu lwezincazelo luphelele ekuchazeni amagama.
- Euismod
- Vestibulum id ligula porta felis euismod semper eget lacinia odio sem.
- Donec id elit non mi porta gravida at eget metus.
- Malesuada porta
- I-Etiam porta sem malesuada magna mollis euismod.
Umbhalo ofomethiwe ngaphambilini
I- <pre>
elementi isethwe kabusha ukuze kukhishwe margin-top
futhi kusetshenziswe rem
amayunithi ayo margin-bottom
.
.ingxenye-yesibonelo { imajini-phansi: 1rem; }
Amathebula
Amathebula alungiswa kancane ukuze abe yisitayela <caption>
sika-s, agoqe imingcele, futhi aqinisekise ukuhambisana text-align
kulo lonke. Izinguquko ezengeziwe zemingcele, iziphedi, nokunye kuza nekilasi ..table
Isihloko sethebula | Isihloko sethebula | Isihloko sethebula | Isihloko sethebula |
---|---|---|---|
Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
Iseli yethebula | Iseli yethebula | Iseli yethebula | Iseli yethebula |
Amafomu
Izakhi zefomu ezahlukahlukene ziqaliswe kabusha ngezitayela zesisekelo ezilula. Nazi ezinye zezinguquko eziphawuleka kakhulu:
<fieldset>
s ayinayo imingcele, i-padding, noma imajini ukuze isetshenziswe kalula njengama-wrappers okokufaka ngakunye noma amaqembu okokufaka.<legend>
s, njengama-fieldsets, aphinde ashintshwa ukuze aboniswe njengesihloko sezinhlobo.<label>
s isethwedisplay: inline-block
ukuze ivumelemargin
ukusetshenziswa.<input>
s,<select>
s,<textarea>
s, kanye no-<button>
s abhekiswa kakhulu ngokuthi Normalize, kodwa Qalisa kabusha kususamargin
futhi namasethiline-height: inherit
, futhi.<textarea>
ama-s alungiswa ukuze akwazi ukukhulisa usayizi oqondile kuphela njengoba usayizi ovundlile ngokuvamile "uphula" ukwakheka kwekhasi.
Lezi zinguquko, nokunye okwengeziwe, kuboniswa ngezansi.
Izakhi ezixubile
Ikheli
Isici <address>
sibuyekezwa ukuze kusethwe kabusha okuzenzakalelayo kwesiphequluli font-style
ukusuka italic
ku- normal
. line-height
nayo manje izuzwe njengefa, futhi margin-bottom: 1rem
yengeziwe. <address>
s ezokwethula imininingwane yokuxhumana yedlozi eliseduze (noma wonke umsebenzi). Londoloza ukufometha ngokuphetha imigqa nge- <br>
.
1355 Market St, Suite 900
San Francisco, CA 94103
P: (123) 456-7890 Igama
Eligcwele [email protected]
I-blockquote
Okuzenzakalelayo margin
kuma-blockquotes ngu- 1em 40px
, ngakho-ke sikusetha kabusha lokho 0 0 1rem
kokuthile okuhambisana kakhulu nezinye izakhi.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. I-integer posuere ilingana ne-ante.
Izakhi ezingaphakathi komugqa
I- <abbr>
elementi ithola isitayela esiyisisekelo sokuyenza ivelele phakathi kombhalo wendima.
Isifinyezo
Okuzenzakalelayo cursor
kusifinyezo ngu- text
, ngakho-ke sisetha kabusha lokho pointer
ukuze sidlulisele ukuthi isici kungaxhunyanwa naso ngokuchofoza kuso.
Eminye imininingwane
Ulwazi olwengeziwe mayelana nemininingwane.
Imininingwane eyengeziwe
Nansi imininingwane eyengeziwe mayelana nemininingwane.
HTML5 [hidden]
isibaluli
I- HTML5 yengeza isibaluli esisha somhlaba wonke esiqanjwe ngokuthi[hidden]
, esiqanjwe ngokuthi display: none
ngokuzenzakalela. Ukuboleka umbono ku- PureCSS , sithuthukisa kulokhu okuzenzakalelayo ngokwenza [hidden] { display: none !important; }
ukusiza ukuvimbela display
ukuthi ingaphumi ngephutha. Nakuba [hidden]
ngokwemvelo ingasekelwe yi-IE10, isimemezelo esicacile ku-CSS yethu sithinta leyo nkinga.
ukungahambisani kwe-jQuery
[hidden]
ayihambisani ne-jQuery $(...).hide()
kanye $(...).show()
nezindlela. Ngakho-ke, okwamanje asikhuthazi kakhulu [hidden]
phezu kwamanye amasu display
okuphatha ama-elementi.
Ukuze nje uguqule ukubonakala kwento ethile, okusho ukuthi display
ayilungiswanga futhi isici sisengaphazamisa ukuhamba kwedokhumenti, sebenzisa isigaba.invisible
esikhundleni salokho .