Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css chrome上的DIV位置向左偏移,而不是firefox_Css_Google Chrome_Css Position - Fatal编程技术网

Css chrome上的DIV位置向左偏移,而不是firefox

Css chrome上的DIV位置向左偏移,而不是firefox,css,google-chrome,css-position,Css,Google Chrome,Css Position,在我的网站主页上,我有一个网格设置,在那里我显示了3行缩略图。尽管在chrome上,您会注意到网格(div class=“grid_gallery”)向左偏移了约8px,使其稍微位于我的侧边栏后面。与firefox相比,firefox的位置很好,与左侧的侧栏对齐 我曾尝试在论坛上搜索有类似问题的人,尽管我基本的html/css术语对我没有帮助 有没有人知道为什么这只发生在chrome上,以及可能的修复方法 提前感谢将.grid gallery类的宽度属性修改为 width: calc(100%

在我的网站主页上,我有一个网格设置,在那里我显示了3行缩略图。尽管在chrome上,您会注意到网格(div class=“grid_gallery”)向左偏移了约8px,使其稍微位于我的侧边栏后面。与firefox相比,firefox的位置很好,与左侧的侧栏对齐

我曾尝试在论坛上搜索有类似问题的人,尽管我基本的html/css术语对我没有帮助

有没有人知道为什么这只发生在chrome上,以及可能的修复方法


提前感谢

将.grid gallery类的宽度属性修改为

width: calc(100% - 250px);

似乎解决了这个问题,至少在Chrome/Firefox开发工具中是这样。试一试,让我们知道它是否有用

我建议您使用为什么不使用flex box添加一个问题示例?有趣的是,Chrome计算vw的方式与Firefox不同。如果你将body标签的宽度设置为100vw,在Chrome中它是1920px(我显示器的宽度),但在Firefox中它是1903pxLooks,就像Firefox包含滚动条的宽度,而Chrome不包含滚动条的宽度一样?非常感谢,这解决了我的问题。很酷,很高兴提供帮助!如果我的答案解决了你的问题,你能投票给我吗?