Tsallake zuwa babban abun ciki Tsallake zuwa kewayawa na takardu

Injin Bootstrap yana mai da martani yana daidaita kaddarorin CSS na gama gari don amfani da sararin da ke akwai a cikin tashoshin kallo da na'urori.

Menene RFS?

Aikin gefen Bootstrap RFS injin ne mai girman juzu'i wanda aka fara ƙirƙira don sake girman girman font (saboda haka taƙaice don Girman Girman Font). A zamanin yau RFS yana da ikon sake ƙididdige yawancin kaddarorin CSS tare da ƙimar naúrar kamar margin, padding, border-radius, ko ma box-shadow.

Na'urar tana ƙididdige ƙididdiga masu dacewa ta atomatik bisa ma'auni na wurin kallon mai lilo. Za a harhada shi zuwa calc()ayyuka tare da gauraya remda raka'o'in kallon kallo don ba da damar ɗabi'ar ƙira mai amsawa.

Amfani da RFS

Ana haɗa mixins a cikin Bootstrap kuma ana samun su da zarar kun haɗa da Bootstrap's scss. Hakanan za'a iya shigar da RFS a tsaye idan an buƙata.

Yin amfani da mixins

Mixin yana da rfs()gajerun hannu don font-size, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, da padding-left. Dubi misalin da ke ƙasa don tushen Sass da haɗa CSS.

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

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

Ana iya mika duk wani kadara zuwa rfs()mahaɗin kamar haka:

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

!importantHakanan za'a iya ƙarawa zuwa duk ƙimar da kuke so:

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

Amfani da ayyuka

Lokacin da ba kwa son amfani da abubuwan da suka haɗa, akwai kuma ayyuka guda biyu:

  • rfs-value()yana canza ƙima zuwa remƙima idan pxƙima ta wuce, a wasu lokuta yana mayar da sakamako iri ɗaya.
  • rfs-fluid-value()yana dawo da sigar ruwa ta ƙimar idan dukiya tana buƙatar sake ƙima.

A cikin wannan misalin, muna amfani da ɗayan ginanniyar ginanniyar Bootstrap don haɗawa da salo kawai a ƙasan wurin lghutu.

.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 */
  }
}

Takaddun da aka fadada

RFS wani shiri ne na daban a ƙarƙashin ƙungiyar Bootstrap. Ana iya samun ƙarin game da RFS da tsarin sa akan ma'ajiyar ta GitHub .