CSS variables

      Use Bootstrap’s CSS custom properties for fast and forward-looking design and development.

      Bootstrap includes around two dozen CSS custom properties (variables) in its compiled CSS, with dozens more on the way for improved customization on a per-component basis. These provide easy access to commonly used values like our theme colors, breakpoints, and primary font stacks when working in your browser’s inspector, a code sandbox, or general prototyping.

      All our custom properties are prefixed with bs- to avoid conflicts with third party CSS.

      Root variables

      Here are the variables we include (note that the :root is required) that can be accessed anywhere Bootstrap’s CSS is loaded. They’re located in our _root.scss file and included in our compiled dist files.

      :root {
      --bs-blue: #0d6efd;
      --bs-indigo: #6610f2;
      --bs-purple: #6f42c1;
      --bs-pink: #d63384;
      --bs-red: #dc3545;
      --bs-orange: #fd7e14;
      --bs-yellow: #ffc107;
      --bs-green: #198754;
      --bs-teal: #20c997;
      --bs-cyan: #0dcaf0;
      --bs-white: #fff;
      --bs-gray: #6c757d;
      --bs-gray-dark: #343a40;
      --bs-primary: #0d6efd;
      --bs-secondary: #6c757d;
      --bs-success: #198754;
      --bs-info: #0dcaf0;
      --bs-warning: #ffc107;
      --bs-danger: #dc3545;
      --bs-light: #f8f9fa;
      --bs-dark: #212529;
      --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
      --bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      --bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
      }
      

      Component variables

      We’re also beginning to make use of custom properties as local variables for various components. This way we can reduce our compiled CSS, ensure styles aren’t inherited in places like nested tables, and allow some basic restyling and extending of Bootstrap components after Sass compilation.

      Have a look at our table documentation for some insight into how we’re using CSS variables.

      We’re also using CSS variables across our grids—primarily for gutters—with more component usage coming in the future.

      Examples

      CSS variables offer similar flexibility to Sass’s variables, but without the need for compilation before being served to the browser. For example, here we’re resetting our page’s font and link styles with CSS variables.

      body {
      font: 1rem/1.5 var(--bs-font-sans-serif);
      }
      a {
      color: var(--bs-blue);
      }
      
      返回頂部
      主站蜘蛛池模板: 亚洲av无码天堂一区二区三区 | 一区二区三区免费在线观看| 中文字幕av日韩精品一区二区| 亚洲一区二区三区乱码在线欧洲| 美女啪啪一区二区三区| 成人免费一区二区三区在线观看| 国产成人一区二区三区在线观看 | 日韩精品午夜视频一区二区三区| 交换国产精品视频一区| 亚洲免费一区二区| 日韩AV片无码一区二区不卡| 日本视频一区二区三区| 国产一区二区不卡老阿姨| 久久精品国产第一区二区三区| 亚洲AV综合色区无码一区爱AV| 一区二区三区免费视频网站| 国产裸体舞一区二区三区| 亚洲AV成人精品日韩一区| 波多野结衣中文一区| av无码一区二区三区| 一区二区手机视频| 久久青草精品一区二区三区| 视频一区精品自拍| 人妻体体内射精一区二区| 少妇无码一区二区三区免费| 亚洲av成人一区二区三区观看在线 | 波多野结衣一区二区免费视频| 波多野结衣一区二区免费视频| 国产一区在线观看免费| 无码喷水一区二区浪潮AV| 在线日韩麻豆一区| а天堂中文最新一区二区三区| 国产成人片视频一区二区| 中文字幕日韩人妻不卡一区| 国产成人一区二区三区在线| 无码少妇一区二区三区| 亚洲熟妇AV一区二区三区浪潮| 风间由美在线亚洲一区| 一区二区三区无码高清视频| 黑人大战亚洲人精品一区| 亚洲一区影音先锋色资源|