RFS

      Bootstrap’s resizing engine responsively scales common CSS properties to better utilize available space across viewports and devices.

      What is RFS?

      Bootstrap’s side project RFS is a unit resizing engine which was initially developed to resize font sizes (hence its abbreviation for Responsive Font Sizes). Nowadays RFS is capable of rescaling most CSS properties with unit values like margin, padding, border-radius, or even box-shadow.

      The mechanism automatically calculates the appropriate values based on the dimensions of the browser viewport. It will be compiled into calc() functions with a mix of rem and viewport units to enable the responsive scaling behavior.

      Using RFS

      The mixins are included in Bootstrap and are available once you include Bootstrap’s scss. RFS can also be installed standalone if needed.

      Using the mixins

      The rfs() mixin has shorthands for font-size, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, and padding-left. See the example below for source Sass and compiled CSS.

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

      Any other property can be passed to the rfs() mixin like this:

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

      !important can also just be added to whatever value you want:

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

      Using the functions

      When you don’t want to use the includes, there are also two functions:

      • rfs-value() converts a value into a rem value if a px value is passed, in other cases it returns the same result.
      • rfs-fluid-value() returns the fluid version of a value if the property needs rescaling.

      In this example, we use one of Bootstrap’s built-in responsive breakpoint mixins to only apply styling below the lg breakpoint.

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

      Extended documentation

      RFS is a separate project under the Bootstrap organization. More about RFS and its configuration can be found on its GitHub repository.

      返回頂部
      主站蜘蛛池模板: 亚洲av日韩综合一区二区三区| 精品福利一区二区三| 国产精品一区二区久久不卡| 久久99热狠狠色精品一区| 末成年女A∨片一区二区| 精品国产日韩亚洲一区在线 | 国产激情一区二区三区在线观看| 91久久精一区二区三区大全| 成人免费观看一区二区| 无码乱人伦一区二区亚洲| 欧洲精品码一区二区三区免费看 | 无码少妇一区二区浪潮av| 在线播放一区二区| 国产波霸爆乳一区二区| 国产嫖妓一区二区三区无码| 国产精品福利一区二区| 日韩精品无码中文字幕一区二区 | 无码人妻精品一区二区三区东京热| 精品国产天堂综合一区在线| 国产成人欧美一区二区三区 | 日韩精品一区二区三区老鸭窝| 日本福利一区二区| 国产成人精品亚洲一区| 日本免费一区尤物| 日韩美一区二区三区| 国产福利电影一区二区三区,日韩伦理电影在线福 | 欧美激情国产精品视频一区二区 | 一区国产传媒国产精品| 毛片一区二区三区| 免费在线观看一区| 亚洲AV成人一区二区三区在线看| 久久99精品国产一区二区三区 | 日韩AV片无码一区二区不卡| 视频一区二区三区在线观看| 日韩精品无码久久一区二区三| 国产色综合一区二区三区| 无码人妻视频一区二区三区| 亚洲日韩中文字幕一区| 国产一区视频在线免费观看| 久久se精品一区精品二区国产| 国产精品高清一区二区三区不卡|