CSS variables
Siv Bootstrap's CSS cov cuab yeej kev cai rau kev tsim thiab kev loj hlob sai thiab zoo.
Bootstrap suav nrog ib ncig ntawm ob lub kaum os CSS kev cai cov khoom (kuj hloov pauv) hauv nws cov CSS suav nrog, nrog rau ntau ntau ntawm txoj hauv kev rau kev txhim kho kev hloov kho ntawm ib qho kev sib txuas. Cov no muab kev nkag tau yooj yim rau cov txiaj ntsig zoo ib yam li peb cov ntsiab lus xim, cov ntsiab lus tawg, thiab cov font loj loj thaum ua haujlwm hauv koj tus browser tus neeg soj ntsuam, code sandbox, lossis kev tsim qauv.
Tag nrho peb cov cuab yeej kev cai yog ua ntej nrogbs-
kom tsis txhob muaj teeb meem nrog CSS thib peb.
Root variables
Nov yog cov kev hloov pauv uas peb suav nrog (nco ntsoov tias qhov :root
yuav tsum tau ua) uas tuaj yeem nkag mus tau txhua qhov chaw Bootstrap's CSS tau thauj khoom. Lawv nyob hauv peb cov _root.scss
ntaub ntawv thiab suav nrog peb cov ntaub ntawv dist uas tau muab tso ua ke.
: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));
}
Cov khoom sib txawv
Peb tseem tab tom pib siv cov cuab yeej kev cai raws li qhov sib txawv hauv zos rau ntau yam khoom. Txoj kev no peb tuaj yeem txo peb cov CSS sau ua ke, xyuas kom cov qauv tsis tau txais txiaj ntsig hauv qhov chaw xws li cov rooj sib ze, thiab tso cai rau qee qhov kev so yooj yim thiab txuas ntxiv ntawm Bootstrap Cheebtsam tom qab Sass muab tso ua ke.
Saib peb cov ntaub ntawv rooj rau qee qhov kev nkag siab txog qhov peb siv CSS hloov pauv li cas .
Peb kuj tseem siv CSS hloov pauv thoob plaws peb daim phiaj-tseem ceeb rau gutters-nrog rau kev siv ntau ntxiv los yav tom ntej.
Piv txwv
CSS variables muaj qhov hloov pauv zoo sib xws rau Sass qhov hloov pauv, tab sis tsis tas yuav tsum tau muab tso ua ke ua ntej muab rau browser. Piv txwv li, ntawm no peb tab tom rov pib dua peb nplooj ntawv font thiab txuas cov qauv nrog CSS sib txawv.
body {
font: 1rem/1.5 var(--bs-font-sans-serif);
}
a {
color: var(--bs-blue);
}