css-variables

Why doesn't Firefox show my SVG icons, and how to do it?

泄露秘密 提交于 2021-01-28 04:22:06
问题 Context I am creating a static website using HTML, CSS and JS only (for learning purposes). I successfully implemented two themes. In order to change it, I added an SVG icon in a button element. The svg then changes according to the theme (moon or sun). Problem While everything runs well in a chromium browser, the SVGs don't show at all using Firefox, but the buttons work as expected. I suspect this comes from the way I use CSS variables to change the path of the SVG on hover . However, using

Replace with Javascript the 'var' css property after it has been already set

不羁的心 提交于 2021-01-27 19:50:55
问题 I've an element with a var property set on it like so: <div class="divwithbackground" style="--page-header-section-background: url('myurlimage.jpg');"> </div> CSS .divwithbackground::after { background-image: var(--page-header-section-background); background-position: center; background-size: cover; } This actually works well. But what if I have another javascript which sets the property: document.documentElement.style.setProperty('--page-header-section-background', bgDataValue, 'important');

CSS variables aren't being set [duplicate]

半腔热情 提交于 2020-12-14 11:59:53
问题 This question already has answers here : How can I define colors as variables in CSS? (19 answers) using css custom properties variables not working (4 answers) Variables in CSS - why can't they be used? (2 answers) Closed 11 days ago . I'm unable to use CSS variables with any browser. I've tried using vscode, and codepen but I can't get the CSS variables to work. Also, I've tried enabling the flags in the Chrome browser and restarting my laptop but it still doesn't work. Here's an image of

Using css variables in sass functions - node-sass

你说的曾经没有我的故事 提交于 2020-07-20 07:12:28
问题 I am trying to use CSS variables in an Angular project together with Sass functions ( lighten() / darken() to be precise), and as far as I know, the latest version of LibSass allows it. I have installed node-sass@4.11.0 and sass-loader@7.1.0 (and on Angular v7.3.0), but yet I receive an error Argument $color of lighten($color, $amount) must be a color Am I missing something? Thanks! 回答1: Unfortunately you can't... lighten is a SASS function at compile-time, while CSS variables are run-time

Are CSS Custom Properties global across linked CSS documents?

牧云@^-^@ 提交于 2020-07-18 03:45:12
问题 I'm experimenting with a lot of success with CSS3 Custom Properties (aka CSS Variables). I'm talking about the --black: #000; and background: var(--black); type variables. However, I'm having no luck when variables are declared in separate linked documents. With CSS Custom Properties being at over 72% browser compatibility (src: https://caniuse.com/#search=css%20variables), I'm keen to start using them in a very specific app where I know my audience are using compatible browsers. I'm

Are CSS Custom Properties global across linked CSS documents?

白昼怎懂夜的黑 提交于 2020-07-18 03:44:08
问题 I'm experimenting with a lot of success with CSS3 Custom Properties (aka CSS Variables). I'm talking about the --black: #000; and background: var(--black); type variables. However, I'm having no luck when variables are declared in separate linked documents. With CSS Custom Properties being at over 72% browser compatibility (src: https://caniuse.com/#search=css%20variables), I'm keen to start using them in a very specific app where I know my audience are using compatible browsers. I'm