change variable values in @media queries
See original GitHub issueI would like to change variable value in media query and have automatically generated css where that variable was used.
I’m currently using variable to determine width of the sidebar:
LEFT_SIDEBAR = 200px;
Then using it as:
.sidebar
width: LEFT_SIDEBAR
.content
left: LEFT_SIDEBAR
But when I try to change variable value in media query it generates nothing:
@media screen and (max-width: 1000px)
LEFT_SIDEBAR = 150px;
What I would expect is to see this:
.sidebar {
width: 200px;
}
.content {
left: 200px;
}
@media screen and (max-width: 1000px) {
.sidebar {
width: 150px;
}
.content {
left: 150px;
}
}
Issue Analytics
- State:
- Created 8 years ago
- Reactions:6
- Comments:6 (1 by maintainers)
Top Results From Across the Web
CSS Using Variables in Media Queries - W3Schools
Now we want to change a variable value inside a media query. Tip: Media Queries are about defining different style rules for different...
Read more >Changing variable value based on media query - Stack Overflow
Considering the variable is designed to change, it makes no sense to give it different values in different scenarios (such as media queries) ......
Read more >Basic CSS: Use a Media query to change a variable
Basic CSS: Use a Media query to change a variable ... All you have to do is put the --penguin-size value and the...
Read more >Using CSS Media Queries and Variables for Responsiveness
"In this article, we'll learn how to make responsiveness for manageable using CSS Media queries and Variables."
Read more >Want CSS variables in media query declarations? Try this!
The first is what I'd recommend to existing Sass users: fall back to Sass variables for media queries, and use CSS variables everywhere...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I do something like that:
And then
This would be awesome for use with dark mode, e.g.