Bootstrap 5 for Internet Explorer 11

christianoliff ☺
2 min readDec 10, 2020

--

Bootstrap 5 (currently in Beta) drops support for IE 11, but with ‘bootstrap-ie11’ you can add support back.

This automatically fixes all CSS issues and adds full JS compatibility with just 1 line of code (a custom stylesheet and two JavaScript polyfills).

Quick start

Usage

Just add this in the <head> which will load the CSS and JS - just for IE users.

<script nomodule>window.MSInputMethodContext && document.documentMode && document.write('<link rel="stylesheet" href="/css/bootstrap-ie11.min.css"><script src="https://cdn.jsdelivr.net/gh/nuxodin/ie11CustomProperties@4.1.0/ie11CustomProperties.min.js"><\/script><script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?features=default,Array.prototype.includes,Array.prototype.find,Number.parseFloat%2CNumber.parse"><\/script>');</script>

If you’d prefer to load the bootstrap-ie11 CSS without JavaScript you could use an IE-only media query as follow:

<link rel="stylesheet" href="/css/bootstrap-ie11.min.css" media="all and (-ms-high-contrast: active), (-ms-high-contrast: none)">

The CSS can be loaded via a CDN:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-ie11@5.0.0-beta1/css/bootstrap-ie11.min.css" media="all and (-ms-high-contrast: active), (-ms-high-contrast: none)">

What does this fix/polyfill?

  • Polyfill for CSS custom properties (ie11CustomProperties)
  • Polyfill to fix all Bootstrap JavaScript components (Polyfill.io)
  • Workaround for the SVG overflow bug
  • Remove the default vertical scrollbar from textarea
  • Correct the text-wrapping and color inheritance for legend
  • Disable auto-hiding scrollbar to avoid overlap on pre
  • Fixes for card image size bug
  • Add the correct display values for template and main.
  • Fixes for modals (.modal-dialog-centered and .modal-dialog-scrollable)
  • Fixes for forms (inputs, checkboxes, radio buttons, switches, selects, ranges, placeholders and floating labels)
  • Fix for the btn-close-white SVG icon color
  • Fix for dark carousel previous and next SVG icon colors
  • Fix for valid-tooltip & invalid-tooltip positioning.
  • Adds vendor prefixes for user-select-auto and user-select-none utilities
bootstrap-ie11 in action

How can I test this?

Demo

See this in action at: https://coliff.github.io/bootstrap-ie11/tests/

--

--