669 questions
0
votes
1
answer
104
views
tailwind does not use CSS variables I defined in global.css [duplicate]
I am trying to make an app, using tailwind for styling. The problem emerges when I try to use my variables with tailwind. I made seperate config for tailwind, declared the variables in global.css, but ...
1
vote
1
answer
70
views
Unexpected variable resolution order in CSS with var/property nesting [duplicate]
My goal is to have an architecture where the shadow is defined once, but the color changes depending on HTML attribute data-color-mode.
Note: code provided is just for the isolated problem ...
-1
votes
2
answers
48
views
Can I combine minmax() with responsive length property in CSS? [duplicate]
I had the idea to use responsive font-size in CSS, so that the font size would depend on the viewport width, but be limited for minimum and maximum size, like this:
@property --font-size-norm { ...
0
votes
0
answers
55
views
How to overwrite popup colors with variables and opacity via the color scheme?
1. Summary
I can’t find how I can overwrite via my color scheme colors in Sublime Text popups, if colors has variables and the color-mod function.
2. MCVE
For example, I have the file KiraExample....
1
vote
1
answer
88
views
How to use rem unit in initial-value for a CSS @property rule?
I'm trying to define a CSS @property rule for a font-size with a rem-based initial value.
https://developer.mozilla.org/en-US/docs/Web/CSS/@property
It works as long as no syntax is defined:
@property ...
1
vote
2
answers
99
views
Combine css variables into one variable
I'm trying to combine/compose multiple css variables into one that I can use but it doesn't seem to be working. In particular I'm trying to combine separate font rules into one where I can then use ...
1
vote
1
answer
36
views
Logging when a CSS variable not found
Is there a way to make a browser log events, when a CSS variable is not found? I'm wondering, because it seems to be useful for debugging. Say, if I have the following code:
.stroked-text
{
/* ...
0
votes
1
answer
101
views
How to use a CSS variable inside a custom HTML element?
I have a custom HTML element I made that creates a repeating background pattern which I animate in. I need the ability to dynamically set the color of this pattern with a CSS variable that lives in ...
0
votes
0
answers
92
views
Issue while assigning CSS variable value to Javascript
In my website, I've a sticky container with a horizontal scroll direction.
The scroll works perfectly. However the issue is, when I tried to get a value from a CSS variable and assign it to Javascript ...
0
votes
0
answers
27
views
Can we take CSS variable value in CSS @keyframes animation? [duplicate]
[EDIT]: To moderators, please read the question carefully before being
in hurry to mark the question duplicate. This question more to take
CSS variable value from JS (set in element style) and not to ...
1
vote
0
answers
49
views
Override root CSS variable without repeating al properties declarations that consume them [duplicate]
Given the following code, the text color is correctly changed in the nested element after updating the root css variable. Is there a way to avoid repeating the color prop twice and get it ...
1
vote
2
answers
77
views
is there a way to assign a different cssVariable to a cssVariable based on the class it is nested in? [duplicate]
we are using a design system that has 'tokens' and 'primitives'.
the idea is that we can connect different baseColors to a different UI-elements depending on the brand.
<h1>Hi this is header&...
0
votes
1
answer
40
views
What's the syntax for passing a CSS custom property in reagent?
How do I create this HTML in Reagent/hiccup?
<span style="--custom-property: value"></span>
Both Hiccup and Reagent fail to document how to pass CSS custom properties.
-1
votes
1
answer
354
views
Use SCSS to convert a CSS variable from HSL to Hex
I have a number of CSS variables containing color values. I'd like to define these in HSL format, but can I let Sass convert these to hex values?
Input:
:root {
--dark: hsl(210, 50%, 13%);
}
Output:...
1
vote
0
answers
72
views
how to use css variables inside javascript in rollup
I have a UI components repo setup with rollup where I want to use my css variables inside my javascript files. I have done this in another repo which was using webpack and it was quite easy:
import ...
0
votes
1
answer
518
views
Can you nest CSS Variables in CSS Variable names
I was wondering if it's possible to nest a CSS Variable within a CSS variable's name or possibly do something similar:
:root {
--color-1: red;
--index: 1;
}
span {
color: var(--color-var(--...
1
vote
1
answer
1k
views
How do I use environnement variable in my CSS using nextJs to specify base color?
how can I use an environment variable to specify the base color in my CSS ?
I use NEXTJS
My colors are all defined as variables in my globals.css :
@layer base {
:root {
...
--primary: #...
0
votes
0
answers
32
views
What is the correct way to define a CSS variable that will inherit from a prior value (of the same name) but have a sensible default? [duplicate]
It seems to me that the best way to use CSS variables in many cases is to have them default to a pre-existing value but have a sensible default.
E.g. instead of writing:
:host {
--background: white;
...
0
votes
1
answer
279
views
How can I override a css variable by code? [duplicate]
How can I override a css variable from dev console (or injected script of extension)
For example for google.com search page lets say I want to change rhs-width variable.
I can clearly see it defined ...
0
votes
1
answer
282
views
CSS variables inheritance and nested shadow roots
I am using VueJS to define two custom web elements, service-card and slot-card.
I allow CSS variables, e.g. --pm-scale: 0.75, to customize the style of the elements.
slot-card can be used ...
1
vote
0
answers
106
views
In CSS Color Level 5, how do you reference the value of a relative color from a custom property (color-mix, color-mod, etc)?
So I'm trying to apply a series of modifications to a color via a custom property, but as far as I can tell it can only go one level deep.
Unless I can find a way to extract the color value from the ...
3
votes
0
answers
195
views
CSS keyframed gradient animation fails on NextJS production build
EDIT: I found that the issue is that during build, the generated css file has the %, from initial-value removed, so it results in just initial-value:0 which is not correct since i'm using perchantage.
...
0
votes
1
answer
213
views
How to set default height of an HTML element and let it adjust to a fixed container height with CSS only
Suppose I'm developing a reusable component, rendered as an HTML element. It can be rendered by anybody in some container. I don't know the styles of the container in advance: it could have a fixed ...
0
votes
1
answer
211
views
Calc with a multivalue css variable [duplicate]
I want to make a hover effect over a p-tag, when hovered the background should get darker. I used filter:brightness(85%) but this made also the text darker. Here is my css.
:root {
--my-color:193 55% ...
1
vote
1
answer
725
views
getPropertyValue sometimes returns empty string for CSS custom property
I am rendering the following style very early in the <head> :
<style>
:root {
--enhanced: false;
}
@supports (selector(:not(.foo))) and
(aspect-ratio: 1 / 1) and
(margin-block-...