Style JSX is not working properly with @media-query
See original GitHub issueBug report
Describe the bug
I am using <style jsx> to style my components. When that code is compiled @media query isn’t executed successfully.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
.post__card .summary {
width: 351px;
}
@media screen and(max-width: 1142px) {
.post__card .summary {
width: 80%;
}
}
Expected behavior
When code is compiled I have jsx-2993501484 post__card and jsx-2993501484 summary and JS is looking for
@media screen and(max-width:1142px) {
.post__card.jsx-2993501484 .summary.jsx-2993501484 {
width: 80%;
}
}
But for some reason style from @media-query is not applied to the element. That part of CSS is not even available in Inspect element in browser
Screenshots

System information
- OS: Manjaro Linux
- Browser: Chrome
- Version of Next.js: ^9.1.8-canary.13
Additional context
Add any other context about the problem here.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Style JSX is not working properly with @media-query in NextJS
This is the current code @media screen and(max-width: 1142px) { .post__card .summary { width: 80%; } }. This is fixed code
Read more >Beginner's guide to media queries - Learn web development
The CSS Media Query gives you a way to apply CSS only when the browser ... well in this orientation may not work...
Read more >'Nested style detected' when dynamically including a media ...
'Nested style detected' when dynamically including a media query in a ... Unfortunately nesting is not supported by styled-jsx. at Function.
Read more >Why is my React stylesheet media query not working?-Reactjs
[Solved]-Why is my React stylesheet media query not working?-Reactjs. Search. score:1. Accepted answer. import React from "react"; import { useMediaQuery } ...
Read more >Using CSS media queries in React with Fresnel
Fresnel transfers the traditional media query approach to the React ... The above example would work fine unless you need to implement a ......
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

Goddammit. I am so stupid. Thank you a lot. A lot
You need to add a space to your media query between
andand(: