Sake yi
Sake yi, tarin takamaiman canje-canje na CSS a cikin fayil guda ɗaya, fara Bootstrap don samar da kyakkyawan tushe, daidaito da sauƙi don ginawa.
Sake yi yana ginawa akan Normalize, yana samar da abubuwan HTML da yawa tare da ɗan salo na ra'ayi ta amfani da masu zaɓin kashi kawai. Ana yin ƙarin salo kawai tare da azuzuwan. Misali, muna sake yin wasu <table>
salo don tushe mafi sauƙi kuma daga baya samar da .table
, .table-bordered
, da ƙari.
Anan ga jagororinmu da dalilan zabar abin da za mu soke a Sake yi:
- Sabunta wasu tsoffin ƙima na burauza don amfani da
rem
s maimakonem
s don tazarar abubuwan da za'a iya daidaitawa. - Guji
margin-top
. Matsakaicin gefe na iya rugujewa, suna ba da sakamako mara tsammani. Mafi mahimmanci ko da yake, shugabanci guda ɗayamargin
shine samfurin tunani mafi sauƙi. - Don sauƙin sikeli a cikin girman na'urar, abubuwan toshe yakamata suyi amfani da
rem
s donmargin
s. - Ci gaba da bayyana
font
kaddarorin da ke da alaƙa da ƙayyadaddun bayanai, ta amfani dainherit
duk lokacin da zai yiwu.
An sabunta abubuwan <html>
da <body>
abubuwan don samar da ingantattun ɓangarorin shafi. Ƙari na musamman:
- An
box-sizing
saita shi a duk duniya akan kowane nau'i-ciki har*::before
da*::after
, zuwaborder-box
. Wannan yana tabbatar da cewa faɗin abubuwan da aka ayyana ba a taɓa wuce gona da iri ba saboda matsi ko iyaka.- Babu tushe
font-size
da aka ayyana akan<html>
, amma16px
ana ɗauka (tsohowar burauzar).font-size: 1rem
ana amfani da shi akan<body>
nau'in nau'in sikelin mai sauƙin amsa ta hanyar tambayoyin kafofin watsa labarai yayin da ake mutunta abubuwan da mai amfani da kuma tabbatar da hanyar da ta fi dacewa.
- Babu tushe
- Hakanan
<body>
yana saita duniyafont-family
,line-height
, datext-align
. Ana gadar wannan daga baya ta wasu sifofi don hana rashin daidaiton rubutu. - Don aminci,
<body>
yana da ayyanabackground-color
, rashin kuskure ga#fff
.
An jefar da tsoffin fonts na gidan yanar gizo (Helvetica Neue, Helvetica, da Arial) a cikin Bootstrap 4 kuma an maye gurbinsu da "tarin rubutun asali" don ingantaccen rubutu akan kowace na'ura da OS. Kara karantawa game da tarin rubutu na asali a cikin wannan labarin Smashing Magazine .
Ana font-family
amfani da wannan ga <body>
kuma gaji ta atomatik a duk duniya cikin Bootstrap. Don canza duniya font-family
, ɗaukaka $font-family-base
kuma sake haɗa Bootstrap.
Duk abubuwan kan gaba-misali, <h1>
-kuma <p>
an sake saita su don margin-top
cire su. An ƙara kanun labarai margin-bottom: .5rem
da sakin layi margin-bottom: 1rem
don sauƙin tazara.
Jagora | Misali |
---|---|
|
h1. Bootstrap jagora |
|
h2. Bootstrap jagora |
|
h3. Bootstrap jagora |
|
h4. Bootstrap jagora |
|
h5. Bootstrap jagora |
|
h6. Bootstrap jagora |
Duk lissafin- <ul>
, <ol>
, da <dl>
- an margin-top
cire su da kuma margin-bottom: 1rem
. Lissafin da aka kafa ba su da margin-bottom
.
- Lorem ipsum dolor sit amet
- Consectetur adipiscing elit
- Integer molestie lorem at massa
- Facilisis a cikin pretium nisl aliquet
- Nulla volutpat aliquam velit
- Phasellus iaculus neque
- Purus sodales ultricies
- Vestibulum laoreet porttitor sem
- Ac tristique libero volutpat a
- Faucibus porta lacus fringilla vel
- Aenean sit amet erat nunc
- Eget porttitor lorem
- Lorem ipsum dolor sit amet
- Consectetur adipiscing elit
- Integer molestie lorem at massa
- Facilisis a cikin pretium nisl aliquet
- Nulla volutpat aliquam velit
- Faucibus porta lacus fringilla vel
- Aenean sit amet erat nunc
- Eget porttitor lorem
Don mafi sauƙin salo, bayyanannen matsayi, da mafi kyawun tazara, lissafin bayanin sun sabunta margin
s. <dd>
sake saitin margin-left
zuwa 0
kuma ƙara margin-bottom: .5rem
. <dt>
s suna da ƙarfi .
- Jerin bayanin
- Jerin bayanin ya dace don ma'anar kalmomi.
- Euismod
- Vestibulum id ligula porta felis euismod semper eget lacinia odio sem.
- Donec id un mi porta gravida a eget metus.
- Malesuada porta
- Ka yi la'akari da abin da ake kira euismod.
An <pre>
sake saita kashi don cire shi margin-top
da amfani rem
da raka'a don sa margin-bottom
.
.misali-bangaren { gefe-kasa: 1rem; }
Tables an ɗan daidaita su zuwa salon <caption>
s, iyakokin rugujewa, da tabbatar da daidaito text-align
a ko'ina. Ƙarin canje-canje don iyakoki, padding, da ƙari sun zo tare da .table
ajin .
Taken tebur | Taken tebur | Taken tebur | Taken tebur |
---|---|---|---|
Tantanin halitta | Tantanin halitta | Tantanin halitta | Tantanin halitta |
Tantanin halitta | Tantanin halitta | Tantanin halitta | Tantanin halitta |
Tantanin halitta | Tantanin halitta | Tantanin halitta | Tantanin halitta |
An sake kunna abubuwa daban-daban don tsarin tushe mafi sauƙi. Ga wasu fitattun sauye-sauye:
<fieldset>
s ba su da iyakoki, padding, ko gefe don haka za a iya amfani da su cikin sauƙi azaman naɗa don abubuwan shigar mutum ɗaya ko ƙungiyoyin bayanai.<legend>
s, kamar fage-fage, an kuma sake tsara su don nunawa azaman jigo na iri.<label>
s an saita dondisplay: inline-block
ba da izininmargin
amfani.<input>
s,<select>
s,<textarea>
s, da<button>
s yawanci ana magance su ta Normalize, amma Sake yi yana cire sumargin
da saitiline-height: inherit
, kuma.<textarea>
s ana canza su ne kawai don a iya sake girman su a tsaye kamar yadda a kwance a kwance sau da yawa ke “karye” shimfidar shafi.
Waɗannan canje-canje, da ƙari, an nuna su a ƙasa.
An <address>
sabunta kashi don sake saita tsohowar burauzar font-style
daga italic
zuwa normal
. line-height
shi ma yanzu an gaji, kuma margin-bottom: 1rem
an kara. <address>
s ne don gabatar da bayanin tuntuɓar kakanni mafi kusa (ko gaba ɗaya na aiki). Ajiye tsarawa ta hanyar ƙare layi da <br>
.
1355 Market St, Suite 900
San Francisco, CA 94103
P: (123) 456-7890 Cikakken Suna
[email protected]
Tsohuwar kan blockquotes margin
shine 1em 40px
, don haka muna sake saita hakan zuwa 0 0 1rem
wani abu mafi dacewa da sauran abubuwan.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ƙididdigar ƙididdiga ta ƙididdigewa.
Abun <abbr>
yana karɓar salo na asali don sanya shi fice tsakanin rubutun sakin layi.
Tsohuwar cursor
taƙaice ita ce text
, don haka muna sake saita hakan pointer
don isar da cewa ana iya mu'amala da sinadarin ta danna shi.
Wasu bayanai
Ƙarin bayani game da cikakkun bayanai.
Ko da ƙarin cikakkun bayanai
Anan akwai ƙarin cikakkun bayanai game da cikakkun bayanai.
HTML5 yana ƙara sabon sifa na duniya mai suna[hidden]
, wanda aka tsara shi azaman display: none
ta tsohuwa. Aron ra'ayi daga PureCSS , mun inganta kan wannan tsoho ta hanyar yin [hidden] { display: none !important; }
don taimakawa hana ta display
yin kuskure da gangan. Duk da yake [hidden]
IE10 ba ta goyan bayan ta asali ba, bayyananniyar fayyace a cikin CSS ɗinmu ta shawo kan wannan matsalar.
rashin jituwa jQuery
[hidden]
bai dace da jQuery's $(...).hide()
da $(...).show()
hanyoyin ba. Don haka, a halin yanzu ba mu yarda [hidden]
da wasu dabaru na sarrafa display
abubuwan abubuwa ba.
Don kawai kunna ganuwa na wani abu, ma'ana display
ba a gyaggyara sa ba kuma har ila yau kashi na iya yin tasiri ga tafiyar daftarin aiki, yi amfani da .invisible
ajin maimakon.