IE11: CSS Variables Polyfill
Question:
Can I use CSS variables in IE11 without native support?
Answer:
Yes, using the CSS Vars Ponyfill.
The CSS Vars Ponyfill is a client-side JavaScript library that transforms CSS custom properties into static values, enabling IE11 browsers to support CSS variables. It offers features such as:
Usage:
Include the ponyfill in your web page:
<script src="https://unpkg.com/css-vars-ponyfill/dist/css-vars-ponyfill.js"></script>
Limitations:
Examples:
:root { --color: red; } p { color: var(--color); }
:root { --size: 1em; --multiplier: 2; } p { font-size: calc(var(--size) * var(--multiplier)); }
W3C Specifications:
The above is the detailed content of Can I use CSS Variables in IE11 without native support?. For more information, please follow other related articles on the PHP Chinese website!