2025-03-08 09:31:15 +01:00
<!DOCTYPE html> < html lang = "en" data-bs-theme = "auto" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1" > < meta name = "description" content = "Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project." > < meta name = "author" content = "Mark Otto, Jacob Thornton, and Bootstrap contributors" > < meta name = "generator" content = "Astro v5.4.2" > < meta name = "docsearch:language" content = "en" > < meta name = "docsearch:version" content = "5.3" > < link rel = "canonical" href = "https://getbootstrap.com/docs/5.3/customize/sass/" > < link rel = "preconnect" href = "https://AK7KMZKZHQ-dsn.algolia.net" crossorigin > < title > Sass · Bootstrap v5.3< / title > < script src = "/docs/5.3/assets/js/color-modes.js" > < / script > < link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/@docsearch/css@3" > < link href = "/docs/5.3/dist/css/bootstrap.min.css" rel = "stylesheet" integrity = "sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" > < link rel = "apple-touch-icon" href = "/docs/5.3/assets/img/favicons/apple-touch-icon.png" sizes = "180x180" > < link rel = "icon" href = "/docs/5.3/assets/img/favicons/favicon-32x32.png" sizes = "32x32" type = "image/png" > < link rel = "icon" href = "/docs/5.3/assets/img/favicons/favicon-16x16.png" sizes = "16x16" type = "image/png" > < link rel = "manifest" href = "/docs/5.3/assets/img/favicons/manifest.json" > < link rel = "mask-icon" href = "/docs/5.3/assets/img/favicons/safari-pinned-tab.svg" color = "#712cf9" > < link rel = "icon" href = "/docs/5.3/assets/img/favicons/favicon.ico" > < meta name = "theme-color" content = "#712cf9" > < meta name = "twitter:card" content = "summary_large_image" > < meta name = "twitter:site" content = "getbootstrap" > < meta name = "twitter:creator" content = "getbootstrap" > < meta name = "twitter:title" content = "Sass" > < meta name = "twitter:description" content = "Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project." > < meta name = "twitter:image" content = "https://getbootstrap.com/docs/5.3/assets/brand/bootstrap-social.png" > < meta property = "og:url" content = "https://getbootstrap.com/docs/5.3/customize/sass/" > < meta property = "og:title" content = "Sass" > < meta property = "og:description" content = "Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project." > < meta property = "og:type" content = "article" > < meta property = "og:image" content = "https://getbootstrap.com/docs/5.3/assets/brand/bootstrap-social.png" > < meta property = "og:image:type" content = "image/png" > < meta property = "og:image:width" content = "2000" > < meta property = "og:image:height" content = "1000" > < script defer src = "https://cdn.usefathom.com/script.js" data-site = "ITUSEYJG" > < / script > < link rel = "stylesheet" href = "/_astro/_slug_.BBRoHHoO.css" > < / head > < body tabindex = "0" data-bs-spy = "scroll" data-bs-target = "#TableOfContents" > < div class = "skippy visually-hidden-focusable overflow-hidden" > < div class = "container-xl" > < a class = "d-inline-flex p-2 m-1" href = "#content" > Skip to main content< / a > < a class = "d-none d-md-inline-flex p-2 m-1" href = "#bd-docs-nav" >
Skip to docs navigation
< / a > < / div > < / div > < svg xmlns = "http://www.w3.org/2000/svg" class = "d-none" > < symbol id = "arrow-right" viewBox = "0 0 16 16" > < path fill-rule = "evenodd" d = "M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z" > < / path > < / symbol > < symbol id = "arrow-right-short" viewBox = "0 0 16 16" > < path fill-rule = "evenodd" d = "M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8" > < / path > < / symbol > < symbol id = "book-half" viewBox = "0 0 16 16" > < path d = "M8.5 2.687c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z" > < / path > < / symbol > < symbol id = "box-seam" viewBox = "0 0 16 16" > < path d = "M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5l2.404.961L10.404 2l-2.218-.887zm3.564 1.426L5.596 5 8 5.961 14.154 3.5l-2.404-.961zm3.25 1.7-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923l6.5 2.6zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464L7.443.184z" > < / path > < / symbol > < symbol id = "braces" viewBox = "0 0 16 16" > < path d = "M2.114 8.063V7.9c1.005-.102 1.497-.615 1.497-1.6V4.503c0-1.094.39-1.538 1.354-1.538h.273V2h-.376C3.25 2 2.49 2.759 2.49 4.352v1.524c0 1.094-.376 1.456-1.49 1.456v1.299c1.114 0 1.49.362 1.49 1.456v1.524c0 1.593.759 2.352 2.372 2.352h.376v-.964h-.273c-.964 0-1.354-.444-1.354-1.538V9.663c0-.984-.492-1.497-1.497-1.6zM13.886 7.9v.163c-1.005.103-1.497.616-1.497 1.6v1.798c0 1.094-.39 1.538-1.354 1.538h-.273v.964h.376c1.613 0 2.372-.759 2.372-2.352v-1.524c0-1.094.376-1.456 1.49-1.456V7.332c-1.114 0-1.49-.362-1.49-1.456V4.352C13.51 2.759 12.75 2 11.138 2h-.376v.964h.273c.964 0 1.354.444 1.354 1.538V6.3c0 .984.492 1.497 1.497 1.6z" > < / path > < / symbol > < symbol id = "braces-asterisk" viewBox = "0 0 16 16" > < path fill-rule = "evenodd" d = "M1.114 8.063V7.9c1.005-.102 1.497-.615 1.497-1.6V4.503c0-1.094.39-1.538 1.354-1.538h.273V2h-.376C2.25 2 1.49 2.759 1.49 4.352v1.524c0 1.094-.376 1.456-1.49 1.456v1.299c1.114 0 1.49.362 1.49 1.456v1.524c0 1.593.759 2.352 2.372 2.352h.376v-.964h-.273c-.964 0-1.354-.444-1.354-1.538V9.663c0-.984-.492-1.497-1.497-1.6ZM14.886 7.9v.164c-1.005.103-1.497.616-1.497 1.6v1.798c0 1.094-.39 1.538-1.354 1.538h-.273v.964h.376c1.613 0 2.372-.759 2.372-2.352v-1.524c0-1.094.376-1.456 1.49-1.456v-1.3c-1.114 0-1.49-.362-1.49-1.456V4.352C14.51 2.759 13.75 2 12.138 2h-.376v.964h.273c.964 0 1.354.444 1.354 1.538V6.3c0 .984.492 1.497 1.497 1.6ZM7.5 11.5V9.207l-1.621 1.621-.707-.707L6.792 8.5H4.5v-1h2.293L5.172 5.879l.707-.707L7.5 6.792V4.5h1v2.293l1.621-1.621.707.707L9.208 7.5H11.5v1H9.207l1.621 1.621-.707.707L8.5 9.208V11.5h-1Z" > < / path > < / symbol > < symbol id = "check2" viewBox = "0 0 16 16" > < path d = "M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z" > < / path > < / symbol > < symbol id = "chevron-expand" viewBox = "0 0 16 16" > < path fill-rule = "evenodd" d = "M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708zm0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708z" > < / path > < / symbol > < symbol id = "circle-half" viewBox = "0 0 16 16" > < path d = "M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z" > < / path > < / symbol > < symbol id = "clipboard" viewBox = "0 0 16 16" > < path d = "M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z" > < / path > < path d = "M9.5 1a . 5 . 5 0 0 1 . 5 . 5
Docs
< / a > < / li > < li class = "nav-item col-6 col-lg-auto" > < a class = "nav-link py-2 px-0 px-lg-2" href = "/docs/5.3/examples/" > Examples < / a > < / li > < li class = "nav-item col-6 col-lg-auto" > < a class = "nav-link py-2 px-0 px-lg-2" href = "https://icons.getbootstrap.com/" target = "_blank" rel = "noopener" > Icons < / a > < / li > < li class = "nav-item col-6 col-lg-auto" > < a class = "nav-link py-2 px-0 px-lg-2" href = "https://themes.getbootstrap.com/" target = "_blank" rel = "noopener" > Themes < / a > < / li > < li class = "nav-item col-6 col-lg-auto" > < a class = "nav-link py-2 px-0 px-lg-2" href = "https://blog.getbootstrap.com/" target = "_blank" rel = "noopener" > Blog < / a > < / li > < / ul > < hr class = "d-lg-none text-white-50" > < ul class = "navbar-nav flex-row flex-wrap ms-md-auto" > < li class = "nav-item col-6 col-lg-auto" > < a class = "nav-link py-2 px-0 px-lg-2 nav-link py-2 px-0 px-lg-2" href = "https://github.com/twbs" target = "_blank" rel = "noopener" > < svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 512 499.36" role = "img" class = "navbar-nav-svg" height = "16" width = "16" > < title > GitHub< / title > < path fill = "currentColor" fill-rule = "evenodd" d = "M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z" > < / path > < / svg > < small class = "d-lg-none ms-2" > GitHub< / small > < / a > < / li > < li class = "nav-item col-6 col-lg-auto" > < a class = "nav-link py-2 px-0 px-lg-2 nav-link py-2 px-0 px-lg-2" href = "https://twitter.com/getbootstrap" target = "_blank" rel = "noopener" > < svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 512 416.32" role = "img" class = "navbar-nav-svg" height = "16" width = "16" > < title > Twitter< / title > < path fill = "currentColor" d = "M160.83 416.32c193.2 0 298.92-160.22 298.92-298.92 0-4.51 0-9-.2-13.52A214 214 0 0 0 512 49.38a212.93 212.93 0 0 1-60.44 16.6 105.7 105.7 0 0 0 46.3-58.19 209 209 0 0 1-66.79 25.37 105.09 105.09 0 0 0-181.73 71.91 116.12 116.12 0 0 0 2.66 24c-87.28-4.3-164.73-46.3-216.56-109.82A105.48 105.48 0 0 0 68 159.6a106.27 106.27 0 0 1-47.53-13.11v1.43a105.28 105.28 0 0 0 84.21 103.06 105.67 105.67 0 0 1-47.33 1.84 105.06 105.06 0 0 0 98.14 72.94A210.72 210.72 0 0 1 25 370.84a202.17 202.17 0 0 1-25-1.43 298.85 298.85 0 0 0 160.83 46.92" > < / path > < / svg > < small class = "d-lg-none ms-2" > Twitter< / small > < / a > < / li > < li class = "nav-item col-6 col-lg-auto" > < a class = "nav-link py-2 px-0 px-lg-2 nav-link py-2 px-0 px-lg-2" href = "https://opencollective.com/bootstrap" target = "_blank" rel = "noopener" > < svg xmlns = "http://www.w3.org/2000/svg" fill = "currentColor" fill-rule = "evenodd" viewBox = "0 0 40 41" role = "img" class = "navbar-nav-svg" height = "16" width = "16" > < title > Open Collective< / title > < path fill-opacity = ".4" d = "M32.8 21c0 2.4-.8 4.9-2 6.9l5.1 5.1c2.5-3.4 4.1-7.6 4.1-12 0-4.6-1.6-8.8-4-12.2L30.7 14c1.2 2 2 4.3 2 7z" > < / path > < path d = "M20 33.7a12.8 12.8 0 0 1 0-25.6c2.6 0 5 .7 7 2.1L32 5a20 20 0 1 0 .1 31.9l-5-5.2a13 13 0 0 1-7 2z" > < / path > < / svg > < small class = "d-lg-none ms-2" > Open Collective< / small > < / a > < / li > < li class = "nav-item py-2 py-lg-1 col-12 col-lg-auto" > < div class = "vr d-none d-lg-flex h-100 mx-lg-2 text-white" > < / div > < hr class = "d-lg-none my-2 text-white-50" > < / li > < li class = "nav-item dropdown" > < button type = "button" class = "btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle" data-bs-toggle = "dropdown" aria-expanded = "false" data-bs-display = "static" > < span class = "d-lg-none" aria-hidden = "true" > Bootstrap< / span > < span class = "visually-hidden" > Bootstrap < / span > v5.3 < span class = "visually-h
Latest (5.3.x)
< svg class = "bi" aria-hidden = "true" > < use xlink:href = "#check2" > < / use > < / svg > < / a > < / li > < li > < a class = "dropdown-item" href = "https://getbootstrap.com/docs/5.2/customize/sass/" >
v5.2.3
< / a > < / li > < li > < a class = "dropdown-item" href = "https://getbootstrap.com/docs/5.1/customize/sass/" >
v5.1.3
< / a > < / li > < li > < a class = "dropdown-item" href = "https://getbootstrap.com/docs/5.0/customize/sass/" >
v5.0.2
< / a > < / li > < li > < hr class = "dropdown-divider" > < / li > < li > < h6 class = "dropdown-header" > Previous releases< / h6 > < / li > < li > < a class = "dropdown-item" href = "https://getbootstrap.com/docs/4.6/" > v4.6.x< / a > < / li > < li > < a class = "dropdown-item" href = "https://getbootstrap.com/docs/3.4/" > v3.4.1< / a > < / li > < li > < a class = "dropdown-item" href = "https://getbootstrap.com/2.3.2/" > v2.3.2< / a > < / li > < li > < hr class = "dropdown-divider" > < / li > < li > < a class = "dropdown-item" href = "/docs/versions/" > All versions< / a > < / li > < / ul > < / li > < li class = "nav-item py-2 py-lg-1 col-12 col-lg-auto" > < div class = "vr d-none d-lg-flex h-100 mx-lg-2 text-white" > < / div > < hr class = "d-lg-none my-2 text-white-50" > < / li > < li class = "nav-item dropdown" > < button class = "btn btn-link nav-link px-0 px-lg-2 py-2 dropdown-toggle d-flex align-items-center" id = "bd-theme" type = "button" aria-expanded = "false" data-bs-toggle = "dropdown" data-bs-display = "static" aria-label = "Toggle theme (auto)" > < svg class = "bi my-1 theme-icon-active" aria-hidden = "true" > < use href = "#circle-half" > < / use > < / svg > < span class = "d-lg-none ms-2" id = "bd-theme-text" > Toggle theme< / span > < / button > < ul class = "dropdown-menu dropdown-menu-end" aria-labelledby = "bd-theme-text" > < li > < button type = "button" class = "dropdown-item d-flex align-items-center" data-bs-theme-value = "light" aria-pressed = "false" > < svg class = "bi me-2 opacity-50" aria-hidden = "true" > < use href = "#sun-fill" > < / use > < / svg >
Light
< svg class = "bi ms-auto d-none" aria-hidden = "true" > < use href = "#check2" > < / use > < / svg > < / button > < / li > < li > < button type = "button" class = "dropdown-item d-flex align-items-center" data-bs-theme-value = "dark" aria-pressed = "false" > < svg class = "bi me-2 opacity-50" aria-hidden = "true" > < use href = "#moon-stars-fill" > < / use > < / svg >
Dark
< svg class = "bi ms-auto d-none" aria-hidden = "true" > < use href = "#check2" > < / use > < / svg > < / button > < / li > < li > < button type = "button" class = "dropdown-item d-flex align-items-center active" data-bs-theme-value = "auto" aria-pressed = "true" > < svg class = "bi me-2 opacity-50" aria-hidden = "true" > < use href = "#circle-half" > < / use > < / svg >
Auto
< svg class = "bi ms-auto d-none" aria-hidden = "true" > < use href = "#check2" > < / use > < / svg > < / button > < / li > < / ul > < / li > < / ul > < / div > < / div > < / nav > < / header > < div class = "container-xxl bd-gutter mt-3 my-md-4 bd-layout" > < aside class = "bd-sidebar" > < div class = "offcanvas-lg offcanvas-start" tabindex = "-1" id = "bdSidebar" aria-labelledby = "bdSidebarOffcanvasLabel" > < div class = "offcanvas-header border-bottom" > < h5 class = "offcanvas-title" id = "bdSidebarOffcanvasLabel" > Browse docs< / h5 > < button type = "button" class = "btn-close" data-bs-dismiss = "offcanvas" aria-label = "Close" data-bs-target = "#bdSidebar" > < / button > < / div > < div class = "offcanvas-body" > < nav class = "bd-links w-100" id = "bd-docs-nav" aria-label = "Docs navigation" > < ul class = "bd-links-nav list-unstyled mb-0 pb-3 pb-md-2 pe-lg-2" > < li class = "bd-links-group py-2" > < strong class = "bd-links-heading d-flex w-100 align-items-center fw-semibold" > < svg class = "bi me-2" style = "color: var(--bs-indigo);" aria-hidden = "true" > < use xlink:href = "#book-half" > < / use > < / svg > Getting started < / strong > < ul class = "list-unstyled fw-normal pb-2 small" > < li > < a href = "/docs/5.3/getting-started/introduction" class = "bd-links-link d-inline-block rounded" > Introduction < / a > < / li > < li > < a href = "/docs/5.3/getting-started/download" class = "bd-links-link d-inline-block rounded" > Download < / a > < / li > < li > < a href = "/docs/5.3/getting-started/contents" class = "bd-links-link d-inline-block rounded" > Contents < / a > < / li > < li > < a href = "/docs/5.3/getting-started/browsers-devices" class = "bd-links-link d-inline-block rounded" > Browsers & devices < / a > < / li > < li > < a href = "/docs/5.3/getting-started/javascript" class = "bd-links-link d-inline-block rounded" > JavaScript < / a > < / li > < li > < a href = "/docs/5.3/getting-started/webpack" class = "bd-links-link d-inline-block rounded" > Webpack < / a > < / li > < li > < a href = "/docs/5.3/getting-started/parcel" class = "bd-links-link d-inline-block rounded" > Parcel < / a > < / li > < li > < a href = "/docs/5.3/getting-started/vite" class = "bd-links-link d-inline-block rounded" > Vite < / a > < / li > < li > < a href = "/docs/5.3/getting-started/accessibility" class = "bd-links-link d-inline-block rounded" > Accessibility < / a > < / li > < li > < a href = "/docs/5.3/getting-started/rfs" class = "bd-links-link d-inline-block rounded" > RFS < / a > < / li > < li > < a href = "/docs/5.3/getting-started/rtl" class = "bd-links-link d-inline-block rounded" > RTL < / a > < / li > < li > < a href = "/docs/5.3/getting-started/contribute" class = "bd-links-link d-inline-block rounded" > Contribute < / a > < / li > < / ul > < / li > < li class = "bd-links-group py-2" > < strong class = "bd-links-heading d-flex w-100 align-items-center fw-semibold" > < svg class = "bi me-2" style = "color: var(--bs-pink);" aria-hidden = "true" > < use xlink:href = "#palette2" > < / use > < / svg > Customize < / strong > < ul class = "list-unstyled fw-normal pb-2 small" > < li > < a href = "/docs/5.3/customize/overview" class = "bd-links-link d-inline-block rounded" > Overview < / a > < / li > < li > < a href = "/docs/5.3/customize/sass" class = "bd-links-link d-inline-block rounded active" aria-current = "page" > Sass < / a > < / li > < li > < a href = "/docs/5.3/customize/options" class = "bd-links-link d-inline-block rounded" > Options < / a > < / li > < li > < a href = "/docs/5.3/customize/color" class = "bd-links-link d-inline-block rounded" > Color < / a > < / li > < li > < a href = "/docs/5.3/customize/color-modes" class = "bd-links-link d-inline-block rounded" > Color modes < / a > < / li > < li > < a href = "/docs/5.3/customize/components" class = "bd-links-link d-inline-block rounded" > Components < / a > < / li > < li > < a href = "/docs/5.3/customize/css-variables" class = "bd-links-link d-inline-block rounded" > CSS variables < / a > < / li > < li > < a href = "/docs/5.3/customize/optimize" class = "bd-links-link d-inline-block rounded" > Optimize < / a > < / li > < / ul > < / li > < li class = "bd-links-group py-2" > < strong class = "bd-links-heading d-flex w-100 align-items-center fw-semibold" > < svg class = "bi me-2" style = "color: var(--bs-teal);" aria-hidden = "true" > < use xlink:href = "#grid-fill" > < / use > < / svg > Layout < / strong > < ul class = "list-unstyled fw-normal pb-2 small" > < li > < a href = "/docs/5.3/layout/breakpoints" class = "bd-links-link d-inline-block rounded" > Breakpoints < / a > < / li > < l
View on GitHub
< / a > < / div > < h1 class = "bd-title mb-0" id = "content" > Sass< / h1 > < / div > < p class = "bd-lead" > Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project. < / p > < script async src = "https://cdn.carbonads.com/carbon.js?serve=CKYIKKJL&placement=getbootstrapcom" id = "_carbonads_js" > < / script > < / div > < div class = "bd-toc mt-3 mb-5 my-lg-0 mb-lg-5 px-sm-1 text-body-secondary" > < button class = "btn btn-link p-md-0 mb-2 mb-md-0 text-decoration-none bd-toc-toggle d-md-none" type = "button" data-bs-toggle = "collapse" data-bs-target = "#tocContents" aria-expanded = "false" aria-controls = "tocContents" >
On this page
< svg class = "bi d-md-none ms-2" aria-hidden = "true" > < use xlink:href = "#chevron-expand" > < / use > < / svg > < / button > < strong class = "d-none d-md-block h6 my-2 ms-3" > On this page< / strong > < hr class = "d-none d-md-block my-2 ms-3" > < div class = "collapse bd-toc-collapse" id = "tocContents" > < nav id = "TableOfContents" > < ul > < li > < a href = "#file-structure" > File structure< / a > < / li > < li > < a href = "#importing" > Importing< / a > < / li > < li > < a href = "#compiling" > Compiling< / a > < / li > < li > < a href = "#including" > Including< / a > < / li > < li > < a href = "#variable-defaults" > Variable defaults< / a > < / li > < li > < a href = "#maps-and-loops" > Maps and loops< / a > < / li > < ul > < li > < a href = "#modify-map" > Modify map< / a > < / li > < li > < a href = "#add-to-map" > Add to map< / a > < / li > < li > < a href = "#remove-from-map" > Remove from map< / a > < / li > < / ul > < li > < a href = "#required-keys" > Required keys< / a > < / li > < li > < a href = "#functions" > Functions< / a > < / li > < ul > < li > < a href = "#colors" > Colors< / a > < / li > < li > < a href = "#color-contrast" > Color contrast< / a > < / li > < li > < a href = "#escape-svg" > Escape SVG< / a > < / li > < li > < a href = "#add-and-subtract-functions" > Add and Subtract functions< / a > < / li > < / ul > < li > < a href = "#mixins" > Mixins< / a > < / li > < ul > < li > < a href = "#color-schemes" > Color schemes< / a > < / li > < / ul > < / ul > < / nav > < / div > < / div > < div class = "bd-content ps-lg-2" > < p > Utilize our source Sass files to take advantage of variables, maps, mixins, and more.< / p >
< h2 id = "file-structure" > File structure< a class = "anchor-link" href = "#file-structure" > < / a > < / h2 >
< p > Whenever possible, avoid modifying Bootstrap' s core files. For Sass, that means creating your own stylesheet that imports Bootstrap so you can modify and extend it. Assuming you' re using a package manager like npm, you' ll have a file structure that looks like this:< / p >
< script type = "module" src = "/_astro/Code.astro_astro_type_script_index_0_lang.BEd1At9B.js" > < / script > < div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-text" > < code is:raw class = "language-text" > your-project/
├── scss/
│ └── custom.scss
└── node_modules/
│ └── bootstrap/
│ ├── js/
│ └── scss/
└── index.html
< / code > < / pre > < / div > < / div >
< p > If you' ve downloaded our source files and aren' t using a package manager, you' ll want to manually create something similar to that structure, keeping Bootstrap' s source files separate from your own.< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-text" > < code is:raw class = "language-text" > your-project/
├── scss/
│ └── custom.scss
├── bootstrap/
│ ├── js/
│ └── scss/
└── index.html
< / code > < / pre > < / div > < / div >
< h2 id = "importing" > Importing< a class = "anchor-link" href = "#importing" > < / a > < / h2 >
< p > In your < code > custom.scss< / code > , you' ll import Bootstrap' s source Sass files. You have two options: include all of Bootstrap, or pick the parts you need. We encourage the latter, though be aware there are some requirements and dependencies across our components. You also will need to include some JavaScript for our plugins.< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token comment" > // Custom.scss< / span >
< span class = "token comment" > // Option A: Include all of Bootstrap< / span >
< span class = "token comment" > // Include any default variable overrides here (though functions won' t be available)< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/bootstrap" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // Then add additional custom code here< / span >
< / code > < / pre > < / div > < / div >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token comment" > // Custom.scss< / span >
< span class = "token comment" > // Option B: Include parts of Bootstrap< / span >
< span class = "token comment" > // 1. Include functions first (so you can manipulate colors, SVGs, calc, etc)< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/functions" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // 2. Include any default variable overrides here< / span >
< span class = "token comment" > // 3. Include remainder of required Bootstrap stylesheets (including any separate color mode stylesheets)< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/variables" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/variables-dark" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // 4. Include any default map overrides here< / span >
< span class = "token comment" > // 5. Include remainder of required parts< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/maps" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/mixins" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/root" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // 6. Optionally include any other parts as needed< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/utilities" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/reboot" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/type" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/images" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/containers" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/grid" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/helpers" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // 7. Optionally include utilities API last to generate classes based on the Sass map in `_utilities.scss`< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/utilities/api" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // 8. Add additional custom code here< / span >
< / code > < / pre > < / div > < / div >
< p > With that setup in place, you can begin to modify any of the Sass variables and maps in your < code > custom.scss< / code > . You can also start to add parts of Bootstrap under the < code > // Optional< / code > section as needed. We suggest using the full import stack from our < code > bootstrap.scss< / code > file as your starting point.< / p >
< h2 id = "compiling" > Compiling< a class = "anchor-link" href = "#compiling" > < / a > < / h2 >
2023-07-26 11:03:01 +03:00
< p > In order to use your custom Sass code as CSS in the browser, you need a Sass compiler. Sass ships as a CLI package, but you can also compile it with other build tools like < a href = "https://gulpjs.com/" > Gulp< / a > or < a href = "https://webpack.js.org/" > Webpack< / a > , or with a GUI applications. Some IDEs also have Sass compilers built in or as downloadable extensions.< / p >
< p > We like to use the CLI to compile our Sass, but you can use whichever method you prefer. From the command line, run the following:< / p >
2025-03-08 09:31:15 +01:00
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-shell" > < code is:raw class = "language-shell" > < span class = "token comment" > # Install Sass globally< / span >
< span class = "token function" > npm< / span > < span class = "token function" > install< / span > < span class = "token parameter variable" > -g< / span > sass
< span class = "token comment" > # Watch your custom Sass for changes and compile it to CSS< / span >
sass < span class = "token parameter variable" > --watch< / span > ./scss/custom.scss ./css/custom.css
< / code > < / pre > < / div > < / div >
< p > Learn more about your options at < a href = "https://sass-lang.com/install/" > sass-lang.com/install< / a > and < a href = "https://code.visualstudio.com/docs/languages/css#_transpiling-sass-and-less-into-css" > compiling with VS Code< / a > .< / p >
< div class = "bd-callout bd-callout-info" > < p > < strong > Using Bootstrap with another build tool?< / strong > Consider reading our guides for compiling with < a href = "/docs/5.3/getting-started/webpack" > Webpack< / a > , < a href = "/docs/5.3/getting-started/parcel" > Parcel< / a > , or < a href = "/docs/5.3/getting-started/vite" > Vite< / a > . We also have production-ready demos in < a href = "https://github.com/twbs/examples" > our examples repository on GitHub< / a > .< / p > < / div >
< h2 id = "including" > Including< a class = "anchor-link" href = "#including" > < / a > < / h2 >
< p > Once your CSS is compiled, you can include it in your HTML files. Inside your < code > index.html< / code > you' ll want to include your compiled CSS file. Be sure to update the path to your compiled CSS file if you' ve changed it.< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-html" > < code is:raw class = "language-html" > < span class = "token doctype" > < span class = "token punctuation" > < !< / span > < span class = "token doctype-tag" > doctype< / span > < span class = "token name" > html< / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > html< / span > < span class = "token attr-name" > lang< / span > < span class = "token attr-value" > < span class = "token punctuation attr-equals" > =< / span > < span class = "token punctuation" > " < / span > en< span class = "token punctuation" > " < / span > < / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > head< / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > meta< / span > < span class = "token attr-name" > charset< / span > < span class = "token attr-value" > < span class = "token punctuation attr-equals" > =< / span > < span class = "token punctuation" > " < / span > utf-8< span class = "token punctuation" > " < / span > < / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > meta< / span > < span class = "token attr-name" > name< / span > < span class = "token attr-value" > < span class = "token punctuation attr-equals" > =< / span > < span class = "token punctuation" > " < / span > viewport< span class = "token punctuation" > " < / span > < / span > < span class = "token attr-name" > content< / span > < span class = "token attr-value" > < span class = "token punctuation attr-equals" > =< / span > < span class = "token punctuation" > " < / span > width=device-width, initial-scale=1< span class = "token punctuation" > " < / span > < / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > title< / span > < span class = "token punctuation" > > < / span > < / span > Custom Bootstrap< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < /< / span > title< / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > link< / span > < span class = "token attr-name" > href< / span > < span class = "token attr-value" > < span class = "token punctuation attr-equals" > =< / span > < span class = "token punctuation" > " < / span > /css/custom.css< span class = "token punctuation" > " < / span > < / span > < span class = "token attr-name" > rel< / span > < span class = "token attr-value" > < span class = "token punctuation attr-equals" > =< / span > < span class = "token punctuation" > " < / span > stylesheet< span class = "token punctuation" > " < / span > < / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < /< / span > head< / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > body< / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < < / span > h1< / span > < span class = "token punctuation" > > < / span > < / span > Hello, world!< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < /< / span > h1< / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < /< / span > body< / span > < span class = "token punctuation" > > < / span > < / span >
< span class = "token tag" > < span class = "token tag" > < span class = "token punctuation" > < /< / span > html< / span > < span class = "token punctuation" > > < / span > < / span >
< / code > < / pre > < / div > < / div >
< h2 id = "variable-defaults" > Variable defaults< a class = "anchor-link" href = "#variable-defaults" > < / a > < / h2 >
< p > Every Sass variable in Bootstrap includes the < code > !default< / code > flag allowing you to override the variable' s default value in your own Sass without modifying Bootstrap' s source code. Copy and paste variables as needed, modify their values, and remove the < code > !default< / code > flag. If a variable has already been assigned, then it won' t be re-assigned by the default values in Bootstrap.< / p >
< p > You will find the complete list of Bootstrap' s variables in < code > scss/_variables.scss< / code > . Some variables are set to < code > null< / code > , these variables don' t output the property unless they are overridden in your configuration.< / p >
2022-12-24 18:43:04 +02:00
< p > Variable overrides must come after our functions are imported, but before the rest of the imports.< / p >
2025-03-08 09:31:15 +01:00
< p > Here' s an example that changes the < code > background-color< / code > and < code > color< / code > for the < code > < body> < / code > when importing and compiling Bootstrap via npm:< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token comment" > // Required< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/functions" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // Default variable overrides< / span >
< span class = "token property" > < span class = "token variable" > $body-bg< / span > < / span > < span class = "token punctuation" > :< / span > #000< span class = "token punctuation" > ;< / span >
< span class = "token property" > < span class = "token variable" > $body-color< / span > < / span > < span class = "token punctuation" > :< / span > #111< span class = "token punctuation" > ;< / span >
< span class = "token comment" > // Required< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/variables" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/variables-dark" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/maps" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/mixins" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/root" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // Optional Bootstrap components here< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/reboot" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/type" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // etc< / span >
< / code > < / pre > < / div > < / div >
< p > Repeat as necessary for any variable in Bootstrap, including the global options below.< / p >
< div class = "bd-callout bd-callout-info" > < p > < strong > Get started with Bootstrap via npm with our starter project!< / strong > Head to the < a href = "https://github.com/twbs/examples/tree/main/sass-js" > Sass & JS example< / a > template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.< / p > < / div >
< h2 id = "maps-and-loops" > Maps and loops< a class = "anchor-link" href = "#maps-and-loops" > < / a > < / h2 >
2022-12-24 18:43:04 +02:00
< p > Bootstrap includes a handful of Sass maps, key value pairs that make it easier to generate families of related CSS. We use Sass maps for our colors, grid breakpoints, and more. Just like Sass variables, all Sass maps include the < code > !default< / code > flag and can be overridden and extended.< / p >
< p > Some of our Sass maps are merged into empty ones by default. This is done to allow easy expansion of a given Sass map, but comes at the cost of making < em > removing< / em > items from a map slightly more difficult.< / p >
2025-03-08 09:31:15 +01:00
< h3 id = "modify-map" > Modify map< a class = "anchor-link" href = "#modify-map" > < / a > < / h3 >
2022-12-24 18:43:04 +02:00
< p > All variables in the < code > $theme-colors< / code > map are defined as standalone variables. To modify an existing color in our < code > $theme-colors< / code > map, add the following to your custom Sass file:< / p >
2025-03-08 09:31:15 +01:00
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token property" > < span class = "token variable" > $primary< / span > < / span > < span class = "token punctuation" > :< / span > #0074d9< span class = "token punctuation" > ;< / span >
< span class = "token property" > < span class = "token variable" > $danger< / span > < / span > < span class = "token punctuation" > :< / span > #ff4136< span class = "token punctuation" > ;< / span >
< / code > < / pre > < / div > < / div >
< p > Later on, these variables are set in Bootstrap' s < code > $theme-colors< / code > map:< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token property" > < span class = "token variable" > $theme-colors< / span > < / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > (< / span >
< span class = "token string" > " primary" < / span > < span class = "token punctuation" > :< / span > < span class = "token variable" > $primary< / span > < span class = "token punctuation" > ,< / span >
< span class = "token string" > " danger" < / span > < span class = "token punctuation" > :< / span > < span class = "token variable" > $danger< / span >
< span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< / code > < / pre > < / div > < / div >
< h3 id = "add-to-map" > Add to map< a class = "anchor-link" href = "#add-to-map" > < / a > < / h3 >
< p > Add new colors to < code > $theme-colors< / code > , or any other map, by creating a new Sass map with your custom values and merging it with the original map. In this case, we' ll create a new < code > $custom-colors< / code > map and merge it with < code > $theme-colors< / code > .< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token comment" > // Create your own map< / span >
< span class = "token property" > < span class = "token variable" > $custom-colors< / span > < / span > < span class = "token punctuation" > :< / span > < span class = "token punctuation" > (< / span >
< span class = "token string" > " custom-color" < / span > < span class = "token punctuation" > :< / span > #900
< span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // Merge the maps< / span >
< span class = "token property" > < span class = "token variable" > $theme-colors< / span > < / span > < span class = "token punctuation" > :< / span > < span class = "token function" > map-merge< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $theme-colors< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $custom-colors< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< / code > < / pre > < / div > < / div >
< h3 id = "remove-from-map" > Remove from map< a class = "anchor-link" href = "#remove-from-map" > < / a > < / h3 >
2022-12-24 18:43:04 +02:00
< p > To remove colors from < code > $theme-colors< / code > , or any other map, use < code > map-remove< / code > . Be aware you must insert < code > $theme-colors< / code > between our requirements just after its definition in < code > variables< / code > and before its usage in < code > maps< / code > :< / p >
2025-03-08 09:31:15 +01:00
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token comment" > // Required< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/functions" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/variables" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/variables-dark" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token property" > < span class = "token variable" > $theme-colors< / span > < / span > < span class = "token punctuation" > :< / span > < span class = "token function" > map-remove< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $theme-colors< / span > < span class = "token punctuation" > ,< / span > < span class = "token string" > " info" < / span > < span class = "token punctuation" > ,< / span > < span class = "token string" > " light" < / span > < span class = "token punctuation" > ,< / span > < span class = "token string" > " dark" < / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/maps" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/mixins" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/root" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // Optional< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/reboot" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token keyword" > @import< / span > < span class = "token string" > " ../node_modules/bootstrap/scss/type" < / span > < span class = "token punctuation" > ;< / span >
< span class = "token comment" > // etc< / span >
< / code > < / pre > < / div > < / div >
< h2 id = "required-keys" > Required keys< a class = "anchor-link" href = "#required-keys" > < / a > < / h2 >
< p > Bootstrap assumes the presence of some specific keys within Sass maps as we used and extend these ourselves. As you customize the included maps, you may encounter errors where a specific Sass map' s key is being used.< / p >
< p > For example, we use the < code > primary< / code > , < code > success< / code > , and < code > danger< / code > keys from < code > $theme-colors< / code > for links, buttons, and form states. Replacing the values of these keys should present no issues, but removing them may cause Sass compilation issues. In these instances, you' ll need to modify the Sass code that makes use of those values.< / p >
< h2 id = "functions" > Functions< a class = "anchor-link" href = "#functions" > < / a > < / h2 >
< h3 id = "colors" > Colors< a class = "anchor-link" href = "#colors" > < / a > < / h3 >
< p > Next to the < a href = "/docs/5.3/customize/color#color-sass-maps" > Sass maps< / a > we have, theme colors can also be used as standalone variables, like < code > $primary< / code > .< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token selector" > .custom-element < / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > color< / span > < span class = "token punctuation" > :< / span > < span class = "token variable" > $gray-100< / span > < span class = "token punctuation" > ;< / span >
< span class = "token property" > background-color< / span > < span class = "token punctuation" > :< / span > < span class = "token variable" > $dark< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< p > You can lighten or darken colors with Bootstrap' s < code > tint-color()< / code > and < code > shade-color()< / code > functions. These functions will mix colors with black or white, unlike Sass' native < code > lighten()< / code > and < code > darken()< / code > functions which will change the lightness by a fixed amount, which often doesn' t lead to the desired effect.< / p >
2024-02-20 17:22:07 +02:00
< p > < code > shift-color()< / code > combines these two functions by shading the color if the weight is positive and tinting the color if the weight is negative.< / p >
2025-03-08 09:31:15 +01:00
< div class = "bd-code-snippet bd-example-snippet bd-file-ref" > < div class = "d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom" > < a class = "font-monospace link-secondary link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href = "https://github.com/twbs/bootstrap/blob/v5.3.3/scss/_functions.scss" > scss/_functions.scss < / a > < div class = "d-flex ms-auto" > < button type = "button" class = "btn-clipboard mt-0 me-0" title = "Copy to clipboard" > < svg class = "bi" aria-hidden = "true" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < / div > < div class = "highlight" > < pre class = "language-scss" > < code class = "language-scss" > < span class = "token comment" > // Tint a color: mix a color with white< / span >
< span class = "token keyword" > @function< / span > < span class = "token function" > tint-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $color< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $weight< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > {< / span >
< span class = "token keyword" > @return< / span > < span class = "token function" > mix< / span > < span class = "token punctuation" > (< / span > white< span class = "token punctuation" > ,< / span > < span class = "token variable" > $color< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $weight< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< span class = "token comment" > // Shade a color: mix a color with black< / span >
< span class = "token keyword" > @function< / span > < span class = "token function" > shade-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $color< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $weight< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > {< / span >
< span class = "token keyword" > @return< / span > < span class = "token function" > mix< / span > < span class = "token punctuation" > (< / span > black< span class = "token punctuation" > ,< / span > < span class = "token variable" > $color< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $weight< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< span class = "token comment" > // Shade the color if the weight is positive, else tint it< / span >
< span class = "token keyword" > @function< / span > < span class = "token function" > shift-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $color< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $weight< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > {< / span >
< span class = "token keyword" > @return< / span > < span class = "token function" > if< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $weight< / span > < span class = "token operator" > >< / span > 0< span class = "token punctuation" > ,< / span > < span class = "token function" > shade-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $color< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $weight< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ,< / span > < span class = "token function" > tint-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $color< / span > < span class = "token punctuation" > ,< / span > -< span class = "token variable" > $weight< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< p > In practice, you' d call the function and pass in the color and weight parameters.< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token selector" > .custom-element < / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > color< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > tint-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $primary< / span > < span class = "token punctuation" > ,< / span > 10%< span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< span class = "token selector" > .custom-element-2 < / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > color< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > shade-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $danger< / span > < span class = "token punctuation" > ,< / span > 30%< span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< span class = "token selector" > .custom-element-3 < / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > color< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > shift-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $success< / span > < span class = "token punctuation" > ,< / span > 40%< span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token property" > background-color< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > shift-color< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $success< / span > < span class = "token punctuation" > ,< / span > -60%< span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< h3 id = "color-contrast" > Color contrast< a class = "anchor-link" href = "#color-contrast" > < / a > < / h3 >
2022-12-24 18:43:04 +02:00
< p > In order to meet the < a href = "https://www.w3.org/TR/WCAG/" > Web Content Accessibility Guidelines (WCAG)< / a > contrast requirements, authors < strong > must< / strong > provide a minimum < a href = "https://www.w3.org/TR/WCAG/#contrast-minimum" > text color contrast of 4.5:1< / a > and a minimum < a href = "https://www.w3.org/TR/WCAG/#non-text-contrast" > non-text color contrast of 3:1< / a > , with very few exceptions.< / p >
2025-03-08 09:31:15 +01:00
< p > To help with this, we included the < code > color-contrast< / code > function in Bootstrap. It uses the < a href = "https://www.w3.org/TR/WCAG/#dfn-contrast-ratio" > WCAG contrast ratio algorithm< / a > for calculating contrast thresholds based on < a href = "https://www.w3.org/TR/WCAG/#dfn-relative-luminance" > relative luminance< / a > in an < code > sRGB< / code > color space to automatically return a light (< code > #fff< / code > ), dark (< code > #212529< / code > ) or black (< code > #000< / code > ) contrast color based on the specified base color. This function is especially useful for mixins or loops where you' re generating multiple classes.< / p >
2022-12-24 18:43:04 +02:00
< p > For example, to generate color swatches from our < code > $theme-colors< / code > map:< / p >
2025-03-08 09:31:15 +01:00
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token keyword" > @each< / span > < span class = "token selector" > < span class = "token variable" > $color< / span > , < span class = "token variable" > $value< / span > in < span class = "token variable" > $theme-colors< / span > < / span > < span class = "token punctuation" > {< / span >
< span class = "token selector" > .swatch-< span class = "token variable" > #{$color}< / span > < / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > color< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > color-contrast< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $value< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< p > It can also be used for one-off contrast needs:< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token selector" > .custom-element < / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > color< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > color-contrast< / span > < span class = "token punctuation" > (< / span > #000< span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span > < span class = "token comment" > // returns `color: #fff`< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< p > You can also specify a base color with our color map functions:< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token selector" > .custom-element < / span > < span class = "token punctuation" > {< / span >
< span class = "token property" > color< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > color-contrast< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $dark< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span > < span class = "token comment" > // returns `color: #fff`< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< h3 id = "escape-svg" > Escape SVG< a class = "anchor-link" href = "#escape-svg" > < / a > < / h3 >
2022-12-24 18:43:04 +02:00
< p > We use the < code > escape-svg< / code > function to escape the < code > < < / code > , < code > > < / code > and < code > #< / code > characters for SVG background images. When using the < code > escape-svg< / code > function, data URIs must be quoted.< / p >
2025-03-08 09:31:15 +01:00
< h3 id = "add-and-subtract-functions" > Add and Subtract functions< a class = "anchor-link" href = "#add-and-subtract-functions" > < / a > < / h3 >
< p > We use the < code > add< / code > and < code > subtract< / code > functions to wrap the CSS < code > calc< / code > function. The primary purpose of these functions is to avoid errors when a " unitless" < code > 0< / code > value is passed into a < code > calc< / code > expression. Expressions like < code > calc(10px - 0)< / code > will return an error in all browsers, despite being mathematically correct.< / p >
2022-12-24 18:43:04 +02:00
< p > Example where the calc is valid:< / p >
2025-03-08 09:31:15 +01:00
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token property" > < span class = "token variable" > $border-radius< / span > < / span > < span class = "token punctuation" > :< / span > .25rem< span class = "token punctuation" > ;< / span >
< span class = "token property" > < span class = "token variable" > $border-width< / span > < / span > < span class = "token punctuation" > :< / span > 1px< span class = "token punctuation" > ;< / span >
< span class = "token selector" > .element < / span > < span class = "token punctuation" > {< / span >
< span class = "token comment" > // Output calc(.25rem - 1px) is valid< / span >
< span class = "token property" > border-radius< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > calc< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $border-radius< / span > < span class = "token operator" > -< / span > < span class = "token variable" > $border-width< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< span class = "token selector" > .element < / span > < span class = "token punctuation" > {< / span >
< span class = "token comment" > // Output the same calc(.25rem - 1px) as above< / span >
< span class = "token property" > border-radius< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > subtract< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $border-radius< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $border-width< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< p > Example where the calc is invalid:< / p >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token property" > < span class = "token variable" > $border-radius< / span > < / span > < span class = "token punctuation" > :< / span > .25rem< span class = "token punctuation" > ;< / span >
< span class = "token property" > < span class = "token variable" > $border-width< / span > < / span > < span class = "token punctuation" > :< / span > 0< span class = "token punctuation" > ;< / span >
< span class = "token selector" > .element < / span > < span class = "token punctuation" > {< / span >
< span class = "token comment" > // Output calc(.25rem - 0) is invalid< / span >
< span class = "token property" > border-radius< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > calc< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $border-radius< / span > < span class = "token operator" > -< / span > < span class = "token variable" > $border-width< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< span class = "token selector" > .element < / span > < span class = "token punctuation" > {< / span >
< span class = "token comment" > // Output .25rem< / span >
< span class = "token property" > border-radius< / span > < span class = "token punctuation" > :< / span > < span class = "token function" > subtract< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $border-radius< / span > < span class = "token punctuation" > ,< / span > < span class = "token variable" > $border-width< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< h2 id = "mixins" > Mixins< a class = "anchor-link" href = "#mixins" > < / a > < / h2 >
2022-12-24 18:43:04 +02:00
< p > Our < code > scss/mixins/< / code > directory has a ton of mixins that power parts of Bootstrap and can also be used across your own project.< / p >
2025-03-08 09:31:15 +01:00
< h3 id = "color-schemes" > Color schemes< a class = "anchor-link" href = "#color-schemes" > < / a > < / h3 >
< p > A shorthand mixin for the < code > prefers-color-scheme< / code > media query is available with support for < code > light< / code > and < code > dark< / code > color schemes. See < a href = "/docs/5.3/customize/color-modes" > the color modes documentation< / a > for information on our color mode mixin.< / p >
< div class = "bd-code-snippet bd-example-snippet bd-file-ref" > < div class = "d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom" > < a class = "font-monospace link-secondary link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href = "https://github.com/twbs/bootstrap/blob/v5.3.3/scss/mixins/_color-scheme.scss" > scss/mixins/_color-scheme.scss < / a > < div class = "d-flex ms-auto" > < button type = "button" class = "btn-clipboard mt-0 me-0" title = "Copy to clipboard" > < svg class = "bi" aria-hidden = "true" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < / div > < div class = "highlight" > < pre class = "language-scss" > < code class = "language-scss" > < span class = "token keyword" > @mixin< / span > < span class = "token function" > color-scheme< / span > < span class = "token punctuation" > (< / span > < span class = "token variable" > $name< / span > < span class = "token punctuation" > )< / span > < span class = "token punctuation" > {< / span >
< span class = "token atrule" > < span class = "token rule" > @media< / span > < span class = "token punctuation" > (< / span > < span class = "token property" > prefers-color-scheme< / span > < span class = "token punctuation" > :< / span > < span class = "token variable" > #{$name}< / span > < span class = "token punctuation" > )< / span > < / span > < span class = "token punctuation" > {< / span >
< span class = "token keyword" > @content< / span > < span class = "token punctuation" > ;< / span >
< span class = "token punctuation" > }< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div >
< div class = "bd-code-snippet" > < div class = "bd-clipboard" > < button type = "button" class = "btn-clipboard" > < svg class = "bi" role = "img" aria-label = "Copy" > < use xlink:href = "#clipboard" > < / use > < / svg > < / button > < / div > < div class = "highlight" > < pre class = "language-scss" > < code is:raw class = "language-scss" > < span class = "token selector" > .custom-element < / span > < span class = "token punctuation" > {< / span >
< span class = "token keyword" > @include< / span > < span class = "token function" > color-scheme< / span > < span class = "token punctuation" > (< / span > light< span class = "token punctuation" > )< / span > < span class = "token punctuation" > {< / span >
< span class = "token comment" > // Insert light mode styles here< / span >
< span class = "token punctuation" > }< / span >
< span class = "token keyword" > @include< / span > < span class = "token function" > color-scheme< / span > < span class = "token punctuation" > (< / span > dark< span class = "token punctuation" > )< / span > < span class = "token punctuation" > {< / span >
< span class = "token comment" > // Insert dark mode styles here< / span >
< span class = "token punctuation" > }< / span >
< span class = "token punctuation" > }< / span >
< / code > < / pre > < / div > < / div > < / div > < / main > < / div > < script src = "/docs/5.3/dist/js/bootstrap.bundle.min.js" integrity = "sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" > < / script > < script type = "module" src = "/_astro/Scripts.astro_astro_type_script_index_0_lang.lFiTneBv.js" > < / script > < script type = "module" src = "/_astro/Scripts.astro_astro_type_script_index_1_lang.CAqD2hc_.js" > < / script > < script type = "module" > const p = ( ) => { const t = document . querySelector ( ".bd-sidebar" ) , a = document . querySelector ( ".bd-links-nav .active" ) ; if ( ! t || ! a ) return ; const c = t . clientHeight , i = a . offsetTop , r = a . clientHeight , n = i , s = n - c + r ; ( t . scrollTop > n || t . scrollTop < s ) && ( t . scrollTop = n - c / 2 + r / 2 ) } , v = ( ) => { document . querySelectorAll ( '[data-bs-toggle="tooltip"]' ) . forEach ( e => { new bootstrap . Tooltip ( e ) } ) , document . querySelectorAll ( '[data-bs-toggle="popover"]' ) . forEach ( e => { new bootstrap . Popover ( e ) } ) ; const t = document . getElementById ( "toastPlacement" ) ; t && document . getElementById ( "selectToastPlacement" ) . addEventListener ( "change" , function ( ) { t . dataset . originalClass || ( t . dataset . originalClass = t . className ) , t . className = ` ${ t . dataset . originalClass } ${ this . value } ` } ) , document . querySelectorAll ( ".bd-example .toast" ) . forEach ( e => { new bootstrap . Toast ( e , { autohide : ! 1 } ) . show ( ) } ) ; const a = document . getElementById ( "liveToastBtn" ) , c = document . getElementById ( "liveToast" ) ; if ( a ) { const e = bootstrap . Toast . getOrCreateInstance ( c ) ; a . addEventListener ( "click" , ( ) => { e . show ( ) } ) } const i = document . getElementById ( "liveAlertPlaceholder" ) , r = ( e , o ) => { const l = document . createElement ( "div" ) ; l . innerHTML = [ ` <div class="alert alert- ${ o } alert-dismissible" role="alert"> ` , ` <div> ${ e } </div> ` , ' <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>' , "</div>" ] . join ( "" ) , i . append ( l ) } , n = document . getElementById ( "liveAlertBtn" ) ; n && n . addEventListener ( "click" , ( ) => { r ( "Nice, you triggered this alert message!" , "success" ) } ) , document . querySelectorAll ( '.carousel:not([data-bs-ride="carousel"])' ) . forEach ( e => { bootstrap . Carousel . getOrCreateInstance ( e ) } ) , document . querySelectorAll ( '.bd-example-indeterminate [type="checkbox"]' ) . forEach ( e => { e . id . includes ( "Indeterminate" ) && ( e . indeterminate = ! 0 ) } ) , document . querySelectorAll ( '.bd-content [href="#"]' ) . forEach ( e => { e . addEventListener ( "click" , o => { o . preventDefault ( ) } ) } ) ; const s = document . getElementById ( "exampleModal" ) ; s && s . addEventListener ( "show.bs.modal" , e => { const l = e . relatedTarget . getAttribute ( "data-bs-whatever" ) , m = s . querySelector ( ".modal-title" ) , u = s . querySelector ( ".modal-body input" ) ; m . textContent = ` New message to ${ l } ` , u . value = l } ) ; const d = document . querySelectorAll ( ".bd-example-offcanvas .offcanvas" ) ; d && d . forEach ( e => { e . addEventListener ( "show.bs.offcanvas" , o => { o . preventDefault ( ) } , ! 1 ) } ) } ; p ( ) ; v ( ) ; < / script > < footer class = "bd-footer py-4 py-md-5 mt-5 bg-body-tertiary" > < div class = "container py-4 py-md-5 px-4 px-md-3 text-body-secondary" > < div class = "row" > < div class = "col-lg-3 mb-3" > < a class = "d-inline-flex align-items-center mb-2 text-body-emphasis text-decoration-none" href = "/" aria-label = "Bootstrap" > < svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 118 94" role = "img" class = "d-block me-2" height = "32" width = "40" > < title > Bootstrap< / title > < path fill-rule = "evenodd" clip-rule = "evenodd" d = "M24.509 0c-6.733 0-11.715 5.893-11.492 12.284.214 6.14-.064 14.092-2.066 20.577C8.943 39.365 5.547 43.485 0 44.014v5.972c5.547.529 8.943 4.649 10.951 11.153 2.002 6.485 2.28 14.437 2.066 20.577C12.794 88.106 17.776 94 24.51 94H93.5c6.733 0 11.714-5.893 11.491-12.284-.214-6.14.064-14.092 2.066-20.577 2.009-6.504 5.396-10.624 10.943-11.153v-5.972c-5.547-.529-8.934-4.649-10.943-11.153-2.002-6.484-2.28-14.437-2.066-20.577C105.214 5.894 100.233 0 93.5 0H24.508zM80 57.863C80 66.663 73.436 72 62.543 72H44a2 2 0 01-2-2V24a2 2 0 012-2h18.437c9.083 0 15.044 4.92 15.044 12.474 0 5.302-4.01 10.049-9.119 10.88v.277C75.317 46.394 80 51.21 80 57.863zM60.521 28.34H49.948v14.934h8.905c6.884 0 10.68-2.772 10.68-7.727 0-4.643-3.264-7.207-9.012-7.207zM49.948 49.2v16.458H60.91c7.167 0 10.964-2.876 10.964-8.281 0-5.406-3.903-8.178-11.425-8.178H49.948z" fill = "currentColor" > < / path > < / svg > < span class
Designed and built with all the love in the world by the < a href = "/docs/5.3/about/team" > Bootstrap team< / a > with the help of < a href = "https://github.com/twbs/bootstrap/graphs/contributors" > our contributors< / a > .
< / li > < li class = "mb-2" >
Code licensed < a href = "https://github.com/twbs/bootstrap/blob/main/LICENSE" target = "_blank" rel = "license noopener" > MIT< / a > , docs < a href = "https://creativecommons.org/licenses/by/3.0/" target = "_blank" rel = "license noopener" > CC BY 3.0< / a > .
< / li > < li class = "mb-2" > Currently v5.3.3.< / li > < / ul > < / div > < div class = "col-6 col-lg-2 offset-lg-1 mb-3" > < h5 > Links< / h5 > < ul class = "list-unstyled" > < li class = "mb-2" > < a href = "/" > Home< / a > < / li > < li class = "mb-2" > < a href = "/docs/5.3/" > Docs< / a > < / li > < li class = "mb-2" > < a href = "/docs/5.3/examples" > Examples< / a > < / li > < li class = "mb-2" > < a href = "https://icons.getbootstrap.com/" > Icons< / a > < / li > < li class = "mb-2" > < a href = "https://themes.getbootstrap.com/" > Themes< / a > < / li > < li class = "mb-2" > < a href = "https://blog.getbootstrap.com/" > Blog< / a > < / li > < li class = "mb-2" > < a href = "https://cottonbureau.com/people/bootstrap" target = "_blank" rel = "noopener" > Swag Store< / a > < / li > < / ul > < / div > < div class = "col-6 col-lg-2 mb-3" > < h5 > Guides< / h5 > < ul class = "list-unstyled" > < li class = "mb-2" > < a href = "/docs/5.3/getting-started" > Getting started< / a > < / li > < li class = "mb-2" > < a href = "/docs/5.3/examples/starter-template" > Starter template< / a > < / li > < li class = "mb-2" > < a href = "/docs/5.3/getting-started/webpack" > Webpack< / a > < / li > < li class = "mb-2" > < a href = "/docs/5.3/getting-started/parcel" > Parcel< / a > < / li > < li class = "mb-2" > < a href = "/docs/5.3/getting-started/vite" > Vite< / a > < / li > < / ul > < / div > < div class = "col-6 col-lg-2 mb-3" > < h5 > Projects< / h5 > < ul class = "list-unstyled" > < li class = "mb-2" > < a href = "https://github.com/twbs/bootstrap" target = "_blank" rel = "noopener" > Bootstrap 5< / a > < / li > < li class = "mb-2" > < a href = "https://github.com/twbs/bootstrap/tree/v4-dev" target = "_blank" rel = "noopener" > Bootstrap 4< / a > < / li > < li class = "mb-2" > < a href = "https://github.com/twbs/icons" target = "_blank" rel = "noopener" > Icons< / a > < / li > < li class = "mb-2" > < a href = "https://github.com/twbs/rfs" target = "_blank" rel = "noopener" > RFS< / a > < / li > < li class = "mb-2" > < a href = "https://github.com/twbs/examples" target = "_blank" rel = "noopener" > Examples repo< / a > < / li > < / ul > < / div > < div class = "col-6 col-lg-2 mb-3" > < h5 > Community< / h5 > < ul class = "list-unstyled" > < li class = "mb-2" > < a href = "https://github.com/twbs/bootstrap/issues" target = "_blank" rel = "noopener" > Issues< / a > < / li > < li class = "mb-2" > < a href = "https://github.com/twbs/bootstrap/discussions" target = "_blank" rel = "noopener" > Discussions< / a > < / li > < li class = "mb-2" > < a href = "https://github.com/sponsors/twbs" target = "_blank" rel = "noopener" > Corporate sponsors< / a > < / li > < li class = "mb-2" > < a href = "https://opencollective.com/bootstrap" target = "_blank" rel = "noopener" > Open Collective< / a > < / li > < li class = "mb-2" > < a href = "https://stackoverflow.com/questions/tagged/bootstrap-5" target = "_blank" rel = "noopener" > Stack Overflow< / a > < / li > < / ul > < / div > < / div > < / div > < / footer > < / body > < / html >