0

Css variable working fine with chrome but not in IE, I'm trying to do this:

:root {
    --primary-color: #015a82;
    --background-color: #015a82;
    --text-color: #fff;
    --secondary-color: #6d6d6d;
}

body {
color: var(--primary-color);
}

But it is not supported in Internet Explorer, I tried to implement postcss-loader but it seems like not compatible with Angular 7, any ideas?

1

2 Answers 2

2

The solution was very simple.

1- npm i css-vars-ponyfill --save.

2- in app.component.ts you have to do this:

import cssVars from 'css-vars-ponyfill';


constructor() {... }

ngOnInit() {
    cssVars();
    ...
    ...
}
Sign up to request clarification or add additional context in comments.

1 Comment

I'd to put it into my component, but that seems to work!
0

Just appended the below script in index html head tag and it's working

<script>window.MSInputMethodContext && document.documentMode && document.write('<script src="https://cdn.jsdelivr.net/gh/nuxodin/[email protected]/ie11CustomProperties.min.js"><\x2fscript>');</script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.