html - 网格布局在 Firefox 中被破坏,但在 Chrome 中却没有

标签 html css google-chrome firefox

对于一个学校元素,我必须制作一个网站。我制作的网站似乎其网格布局在 Firefox 中显示不正确。在 chrome/所有浏览器中,它应该看起来像这样 chrome screenshot

但是在 Firefox 中它会像这样出现,

firefox screenshot

It's almost like there's padding on the container or a margin on the row, but there isn't.

img gif

如果有人能提供帮助那就太好了。我在这里添加了一个JSFiddle,https://jsfiddle.net/o31t9eLb/

最佳答案

您应该在 .sidebar 和 .container 上添加 vertical-align: top;,因为默认情况下,vertical-align 设置为中间。

原因在这里得到了很好的解释:Default value of vertical-align for table cells

关于html - 网格布局在 Firefox 中被破坏,但在 Chrome 中却没有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41115501/

相关文章:

html - 如何链接特定元素的 css?

html - 居中对齐div

javascript - 屏幕底部的温泉元素列表

javascript - 如何调试旧版 javascript 代码(在 IE 中工作正常,但在 Google Chrome 中异常)

html - 为什么设置不透明度会导致 div 覆盖 DOM/页面中较低的 div?

javascript - jquery ui 可排序垃圾箱显示和隐藏事件

css - 动画边框不必要的延迟

google-chrome - 无法通过 ANT 运行测试

google-chrome - Chrome 远程调试不适用于 IP

html - 如何使用CSS在断词中添加自动连字符