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

107
Views
Media queries on Javascript isnt working here

Why isn't the @media query working here? how to fix it? What's wrong with the media queries?

const Size = {
  laptop: "1024px",
  laptopL: "1440px"
}

const Device = {
  laptop: `only screen and max-width: ${Size.laptop}`,
  laptopL: `only screen and max-width: ${Size.laptopL}`,
};

const GlobalStyle = createGlobalStyle `
  body{
    background: url(${BackgroundImage}) no-repeat center center/100% 100% fixed;
  }
  @media ${Device.laptop} {
    body{
      background-size: cover;
    }
  }
`;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need round brackets around your max-width and pixel size. Try this:

const Device = {
  laptop: `only screen and (max-width: ${Size.laptop})`,
  laptopL: `only screen and (max-width: ${Size.laptopL})`,
};
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!