简体   繁体   English

为什么我的网格在 Chrome 中不起作用,但在 Firefox Developer Edition 中起作用?

[英]Why my grid doesn't work in Chrome but, does in Firefox Developer Edition?

I have a project that I'm working on and I use CSS grids to style it as I want.我有一个正在处理的项目,我使用 CSS 网格根据需要对其进行样式设置。 The problem is sometimes it works in Chrome and sometimes it doesn't问题是有时它在 Chrome 中工作,有时它不

Look at screenshot and below it is the code:-看截图,下面是代码:-

The screenshots are at the same zoom level and the same pixel ratio, and the same pixel size!屏幕截图的缩放级别和像素比相同,像素大小相同! This is the navigation in Google Chrome made with the grid system这是 Google Chrome 中使用网格系统制作的导航

我在 Chrome 中的导航右侧有一个奇怪的蓝色空间

And this is the navigation in Firefox Developer Edition made with the grid system这是使用网格系统制作的Firefox Developer Edition中的导航

与 Firefox 相同的导航但没有蓝色空间

And here is my code这是我的代码

HTML

<!-- START: GRID CONTAINER -->
    <div class="l-grid">
      <!-- START: RESPONSIVE NAVBAR -->
      <nav class="l-navigation" data-screen="mini">
        <div class="l-navigation__cart js-miniCartTrigger" data-icon="miniCart">
          <a href="#" class="l-navigation--cart--focus"
            ><i class="fas fa-shopping-cart l-navigation__cart--icon"></i
          ></a>
        </div>
        <!-- Make the whole div a hyperlink -->
        <!-- Remember to remove this element when using the mini cart because it's clickable even when its beneath it -->
        <div
          class="l-navigation__logo"
          onclick="location.href='http:/\/localhost:5500/index.html'"
        >
          <i class="fas fa-gem l-navigation__logo--icon"></i>
          <h2 class="l-navigation__logo--title">The H</h2>
        </div>
        <div class="l-navigation__menu" data-menu="miniMenu">
          <a href="#" class="l-navigation--menu--focus"
            ><i class="fas fa-bars l-navigation__menu--icon js-navigationIcon"></i
          ></a>
            <i class="fas fa-times l-navigation__menu--icon u-d-none js-navigationIconCancel"></i
          ></a>
        </div>
        <!-- END: RESPONSIVE NAVBAR -->
      </nav>
       <!-- END: GRID -->
     </div>

CSS for the grid网格的CSS

.l-grid {
  display: grid;
  height: 100vh;
  grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
  grid-auto-rows: 7rem;
  gap: 0.3rem;
  grid-template-areas: "navigation";
}

CSS for the navigation用于导航的CSS


.l-navigation {
  grid-area: navigation;
  background-color: $color-navigation-bar;
  border-bottom: 1px solid $color-navigation-border;
  display: flex;
  justify-content: space-between;
  align-content: center;
  padding: 2rem;
}

Can you tell me what is wrong here?你能告诉我这里有什么问题吗? And if possible can you tell me how can I make the grid system suitable for mobile-first designing?如果可能,您能告诉我如何使网格系统适合移动优先设计吗?

Thanks谢谢

So, to answer my question所以,回答我的问题

Well, the problem is not something with the code but actually with Google Chrome So I'm keeping it here for others to see and find the answer嗯,问题不在于代码,而在于 Google Chrome 所以我把它留在这里供其他人查看和找到答案

If you restart your computer or remove the cache it works great and it doesn't have anything to do with the code itself如果您重新启动计算机或删除缓存,它会很好用,并且与代码本身没有任何关系

Well, actually if you just resize the window without going to the responsive panel in the inspect element tool in Chrome it works好吧,实际上,如果您只是调整窗口大小而不转到 Chrome 中检查元素工具中的响应面板,则它可以工作

I found the answer for this stupid and silly thing after 2 hours of wasting time here and there我在这里和那里浪费了 2 个小时的时间后,找到了这件愚蠢而愚蠢的事情的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我的音频可视化器在 chrome 中不起作用(但在 Firefox 中起作用) - My audio visualizer doesn't work in chrome (but does in firefox) 为什么我的可视界面在 IE 11 上不起作用,但它在边缘、chrome firefox 等中起作用。显示:flexbox 可能是问题所在? - Why my visual interface doesn't work on IE 11 but yes it does in edge, chrome firefox etc.. display:flexbox could be the problem? 为什么切换在 Firefox 开发人员工具上不起作用? - Why toggling doesn't work on Firefox Developer Tools? Webfonts在Firefox Developer Edition 54.0a2中不起作用 - Webfonts don't work in Firefox Developer Edition 54.0a2 隐藏的溢出不适用于Firefox,但适用于IE和Chrome - Overflow hidden doesn't work on firefox, but does work in IE and chrome 我的网站无法在IE中使用(但可以在chrome和firefox中使用) - My website doesn't work in I.E. (but does in chrome and firefox) Z-index在Chrome中无效,但在Firefox中有效 - Z-index doesn't work in chrome but does in firefox 为什么JavaScript不适用于Firefox / Chrome但适用于IE? - Why doesn't the JavaScript work for Firefox/Chrome but for IE? 为什么我的页面在Firefox中工作但在Safari或Chrome中不起作用? - Why does my page work in Firefox but not in Safari or Chrome? 为什么 display:none 在 Firefox 上不起作用? - Why does display:none doesn't work on Firefox?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM