Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
How can I pass css variable to media queries in Javascript Object?

I want to pass css variable into my media query but I don't know how.

It's a Next.Js project, and I use theme-ui's sx property to assign style.

const styles = {

    headerLinkContainer: {
        width: '500px',
        justifyContent: 'space-evenly',
        alignItems: 'center',
        "@media screen and (min-width: var(--medium-devices))": {
            display: 'none',
        }
    },
}

I tried "@media screen and (min-width: 'var(--medium-devices)')" but it doesn't work.

Can you help me guys ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You cannot use media queries in js. The best solution is this:

if (window.matchMedia("(min-width: 600px)").matches) {
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!