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);
      }
      
      返回頂部
      主站蜘蛛池模板: 2014AV天堂无码一区| 日本在线电影一区二区三区| 99精品国产高清一区二区| 福利一区二区三区视频在线观看 | 亚洲高清一区二区三区| 亚洲国产欧美日韩精品一区二区三区| 亚洲欧美日韩中文字幕一区二区三区 | 性色av无码免费一区二区三区| 国产精品一区二区电影| 亚洲欧洲一区二区三区| 日韩免费视频一区二区| 国产精品无码一区二区在线观| 日韩精品一区二区三区在线观看| 一区二区三区无码视频免费福利 | 亚洲AV无码一区二区三区性色| 无码人妻aⅴ一区二区三区有奶水| 一区二区高清在线观看| 久久er99热精品一区二区| 国产成人精品无码一区二区老年人| 久久99国产一区二区三区| 久久亚洲一区二区| 久久亚洲色一区二区三区| 日韩精品无码一区二区三区AV | 日本美女一区二区三区| 精品视频一区在线观看| 在线精品国产一区二区三区| 无码av免费一区二区三区试看| 亚洲一区免费视频| 国产一区二区三区无码免费| 久久精品国产一区二区三区不卡| 亚洲一区二区三区自拍公司| 国产成人精品日本亚洲专一区 | 亚洲国产综合精品中文第一区| 无码AV天堂一区二区三区| 99久久无码一区人妻a黑| 色视频综合无码一区二区三区| 久久亚洲国产精品一区二区| 无码国产精品一区二区免费I6| 无码毛片一区二区三区中文字幕| 精品一区二区三区中文字幕| 人妻av综合天堂一区|