CSS fesuiaiga
Fa'aoga le CSS aganu'u meatotino a Bootstrap mo le vave ma le lumana'i mamanu ma atina'e.
O le Bootstrap e aofia ai le tele o meatotino aganuʻu CSS (suiga) i lana CSS tuʻufaʻatasia mo le faʻatulagaina o taimi moni e aunoa ma le manaʻomia e toe faʻapipiʻi Sass. O nei mea e maua ai le avanoa faigofie i tulaga fa'aoga masani e pei o lanu o tatou autu, fa'amaufa'ailoga, ma fa'aputu vaitusi autu pe a galue i le su'esu'ega a lau su'esu'ega, se pusa oneone, po'o le fa'ata'ita'iga lautele.
O a matou meatotino tu'ufa'atasi uma o lo'o fa'apipi'iinabs-
e 'alofia ai fete'ena'iga ma isi vaega CSS.
Fesuia'iga a'a
O fesuiaiga nei matou te aofia ai (matau e :root
manaʻomia) e mafai ona maua i soʻo se mea e utaina ai le CSS Bootstrap. O lo'o i totonu o la matou _root.scss
faila ma aofia ai i totonu oa matou faila tu'ufa'atasia.
: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-black: #000;
--bs-white: #fff;
--bs-gray: #6c757d;
--bs-gray-dark: #343a40;
--bs-gray-100: #f8f9fa;
--bs-gray-200: #e9ecef;
--bs-gray-300: #dee2e6;
--bs-gray-400: #ced4da;
--bs-gray-500: #adb5bd;
--bs-gray-600: #6c757d;
--bs-gray-700: #495057;
--bs-gray-800: #343a40;
--bs-gray-900: #212529;
--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-primary-rgb: 13, 110, 253;
--bs-secondary-rgb: 108, 117, 125;
--bs-success-rgb: 25, 135, 84;
--bs-info-rgb: 13, 202, 240;
--bs-warning-rgb: 255, 193, 7;
--bs-danger-rgb: 220, 53, 69;
--bs-light-rgb: 248, 249, 250;
--bs-dark-rgb: 33, 37, 41;
--bs-white-rgb: 255, 255, 255;
--bs-black-rgb: 0, 0, 0;
--bs-body-color-rgb: 33, 37, 41;
--bs-body-bg-rgb: 255, 255, 255;
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, 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));
--bs-body-font-family: var(--bs-font-sans-serif);
--bs-body-font-size: 1rem;
--bs-body-font-weight: 400;
--bs-body-line-height: 1.5;
--bs-body-color: #212529;
--bs-body-bg: #fff;
--bs-border-width: 1px;
--bs-border-style: solid;
--bs-border-color: #dee2e6;
--bs-border-color-translucent: rgba(0, 0, 0, 0.175);
--bs-border-radius: 0.375rem;
--bs-border-radius-sm: 0.25rem;
--bs-border-radius-lg: 0.5rem;
--bs-border-radius-xl: 1rem;
--bs-border-radius-2xl: 2rem;
--bs-border-radius-pill: 50rem;
--bs-link-color: #0d6efd;
--bs-link-hover-color: #0a58ca;
--bs-code-color: #d63384;
--bs-highlight-bg: #fff3cd;
}
Su'ega vaega
Bootstrap 5 o loʻo faʻateleina le faʻaogaina o mea faʻapitoa e fai ma fesuiaiga i le lotoifale mo vaega eseese. O le auala lea e fa'aitiitia ai la tatou CSS tu'ufa'atasia, fa'amautinoa e le tu'ufa'atasia sitaili i nofoaga e pei o laulau fa'amoega, ma fa'ataga nisi o fa'avae fa'avae ma fa'alautele vaega o Bootstrap pe a mae'a fa'atasia Sass.
Va'ai i la matou laulau fa'amaumauga mo ni fa'amatalaga i le fa'aogaina o le CSS fesuiaiga . E fa'aogaina fo'i e a matou navbars suiga CSS e pei o le v5.2.0. O lo'o matou fa'aogaina fo'i suiga CSS i luga o la matou fa'asologa—fa'apitoa mo alavai o le fa'asologa fou o le CSS -fa'atasi ai ma le tele o mea e fa'aogaina i le lumana'i.
So'o se taimi e mafai ai, matou te tu'uina atu suiga CSS i le vaega fa'avae (fa'ata'ita'iga, .navbar
mo le navbar ma ona vaega laiti). E fa'aitiitia ai le taumate po'o fea ma pe fa'afefea ona fa'avasega, ma fa'ataga mo suiga faigofie a la matou 'au i fa'afouga i le lumana'i.
Prefix
Ole tele ole CSS e fa'aogaina se prefix e aloese ai mai fete'ena'iga ma lau oe codebase. O lenei prefix e fa'aopoopo i le --
mea e mana'omia i so'o se fesuiaiga CSS.
Fa'asinomaga le prefix e ala i le $prefix
fesuiaiga Sass. Ona o le faaletonu, ua setiina i bs-
(matau le vase laina mulimuli).
Faataitaiga
CSS fesuiaiga e ofoina atu tutusa fetuutuunai i fesuiaiga a Sass, ae aunoa ma le manaʻomia mo le tuʻufaʻatasia aʻo leʻi tuʻuina atu i le suʻega. Mo se fa'ata'ita'iga, o lo'o matou toe fa'afo'i le vai papatisoga ma sitaili feso'ota'iga ma fesuiaiga CSS.
body {
font: 1rem/1.5 var(--bs-font-sans-serif);
}
a {
color: var(--bs-blue);
}
Fa'amama fa'a
A'o matou fa'aaofia a matou fa'asologa fa'asologa e pei o suiga CSS (sei vagana ai xs
), ia nofouta e le aoga le CSS i fesili fa'asalalau . Ole mea lea e ala ile mamanu ile CSS spec mo fesuiaiga, ae mafai ona suia i tausaga a sau ma le lagolago mo env()
fesuiaiga. Siaki lenei tali Stack Overflow mo nisi fesoʻotaʻiga fesoasoani. I le taimi nei, e mafai ona e faʻaogaina nei fesuiaiga i isi tulaga CSS, faʻapea foʻi ma lau JavaScript.