最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - How do i prevent Next.js from converting @media from max-width to "<=" format? - Stack Overflow

programmeradmin0浏览0评论

In my Next.js project I have a CSS file with a responsive rule:

@media screen and (max-width: 1080px) {
  .content-box {
    flex-direction: column;
  }
}

This rule is correctly applied on my desktop browsers, however it isn't working on my mobile (375px innerWidth). The content-box is not changed to column. Debugging with Safari I can also see that the rule is not being applied.

When I examine the project source code, I see that Next JS has generated its own CSS file called "styles_f15045._.css"

This CSS file has converted my rule to use the <= format:

@media screen and (width <= 768px) {...}

This seems to be what is causing the problem, as when I add the @media rule directly in a style tag, it works as expected.

Is it possible to change the way Next.js repackages my CSS? Or is there another common solution to this issue?

发布评论

评论列表(0)

  1. 暂无评论