Tsibela kumxholo ophambili Tsiba uye kukhangelo lwamaxwebhu

I-Bootstrap ye-injini yokutshintsha ubungakanani ngokuphendula isikali seempawu eziqhelekileyo ze-CSS ukuze isebenzise ngcono indawo ekhoyo kuzo zonke iindawo zokujonga kunye nezixhobo.

Yintoni i-RFS?

Iprojekthi yecala leBootstrap i- RFS yiyunithi yokutshintsha ubungakanani benjini eyathi yaphuhliswa ekuqaleni ukuze ikhulise ubungakanani befonti (kungoko isishunqulelo sayo soBubungakanani beeFonti eziphendulayo). Kule mihla i RFS iyakwazi ukukala kwakhona iipropati ezininzi ze CSS ngamaxabiso eyunithi afana margin, padding, border-radiusokanye nokuba box-shadow.

Umatshini ubala ngokuzenzekelayo amaxabiso afanelekileyo ngokusekwe kwimilinganiselo yesikhangeli sokujonga isikhangeli. Iza kudityaniswa ibe calc()yimisebenzi kunye nomxube remkunye neeyunithi zokujonga ukwenza indlela yokuziphatha ephendulayo yokulinganisa.

Ukusebenzisa i-RFS

Imixube ibandakanyiwe kwiBootstrap kwaye iyafumaneka xa ubandakanya iBootstrap's scss. I-RFS inokufakwa ngokuzimeleyo ukuba iyafuneka.

Ukusebenzisa imixube

I- rfs()mixin ine-shorthands ye- font-size, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, kunye padding-left. Jonga umzekelo ongezantsi weSass yomthombo kunye neCSS ehlanganisiweyo.

.title {
  @include font-size(4rem);
}
.title {
  font-size: calc(1.525rem + 3.3vw);
}

@media (min-width: 1200px) {
  .title {
    font-size: 4rem;
  }
}

Nayiphi na enye ipropathi inokudluliselwa rfs()kumxube onje:

.selector {
  @include rfs(4rem, border-radius);
}

!importantUngongeza nakweliphi na ixabiso olifunayo:

.selector {
  @include padding(2.5rem !important);
}

Ukusebenzisa imisebenzi

Xa ungafuni ukusebenzisa okubandakanya, kukho imisebenzi emibini:

  • rfs-value()iguqula ixabiso libe remlixabiso ukuba pxixabiso ligqithisiwe, kwezinye iimeko libuyisela isiphumo esifanayo.
  • rfs-fluid-value()ibuyisela ulwelo lwexabiso ukuba ipropati ifuna ukucandwa kwakhona.

Kulo mzekelo, sisebenzisa enye ye-Bootstrap eyakhelwe-ngaphakathi ephendula i-breakpoint mixins ukuze sisebenzise kuphela isitayile esingaphantsi kwe- lgbreakpoint.

.selector {
  @include media-breakpoint-down(lg) {
    padding: rfs-fluid-value(2rem);
    font-size: rfs-fluid-value(1.125rem);
  }
}
@media (max-width: 991.98px) {
  .selector {
    padding: calc(1.325rem + 0.9vw);
    font-size: 1.125rem; /* 1.125rem is small enough, so RFS won't rescale this */
  }
}

Amaxwebhu awandisiweyo

I-RFS yiprojekthi eyahlukileyo phantsi kombutho weBootstrap. Okunye malunga ne-RFS kunye noqwalaselo lwayo lunokufumaneka kwindawo yokugcina ye- GitHub .