A 100% pure CSS icon implementation of Bootstrap Icons using CSS custom properties and SVG masks.
Docs and icon gallery: https://coliff.github.io/bootstrap-icons-css/docs/
color or background-colorwidth and height (icons scale to fit with mask-size: contain)By using CSS custom properties the icons can also be used as background-images instead of masks if needed.
color or CSS variables; no need for separate icon assets per theme.--bi-* or background-color on any element (or a parent) to style icons without extra classes.currentColor and variables from the cascade, so they fit naturally into your design system.Include the stylesheet:
<link rel="stylesheet" href="bootstrap-icons.min.css" />
Each icon is exposed as a CSS variable --bi-<name> whose value is a url("data:image/svg+xml;utf8,...") data URI.
Use the same class names as Bootstrap Icons: add the base class bi plus the icon class bi-<name>.
<i class="bi bi-0-circle"></i>
<i class="bi bi-heart"></i>
<i class="bi bi-star-fill" style="color: #ffd700"></i>
<i class="bi bi-cpu" style="height: 2rem; width: 2rem"></i>
Icons inherit color and default to 1rem. Resize with width and height.
Use the variables anywhere—e.g. a repeating mask with custom color and size:
.my-banner {
background-color: hotpink;
display: inline-block;
height: 3rem;
mask-image: var(--bi-heart);
mask-repeat: repeat;
mask-size: 32px 32px;
width: 640px;
}
Or as a background image with background-image: var(--bi-heart);, background-size: contain, etc.
mask-image is supported unprefixed in all modern browsers (Chrome 120, Safari 15.4, Firefox 53 — caniuse). To widen support (e.g. older Safari), use Autoprefixer to add -webkit-mask-image alongside mask-image. Because this uses CSS variables, the same variables are referenced from :root without increasing filesize. Neat!
The stylesheet is approx 1.3 MB (~230 KB gzipped) and includes all 2078 icons. I recommend only including the CSS (or variables) for the icons you need to reduce file size and improve performance.