简体   繁体   English

Firefox和Chrome中的CSS网格呈现方式不同

[英]css-grid rendering differently in Firefox and Chrome

Heads up - I'm new here, and new to some of the css-grid stuff. 抬头-我是这里的新手,并且是某些CSS网格东西的新手。 Bear with me if this isn't a peak Stack Overflow question. 如果这不是堆栈溢出的高峰问题,请多多包涵。

I'm implementing the Slick jquery slider/carousel plugin into the website. 我正在网站上实现Slick jquery滑块/轮播插件。 However, I need the carousel slides to (a) all be the exact same height, and (b) be the same height as the slide with the tallest content. 但是,我需要轮播幻灯片要(a)高度完全相同,并且(b)要与内容最高的幻灯片相同。 I'm getting two different responses on Firefox and Chrome when I try to modify the css to allow for this 当我尝试修改css以允许此操作时,在Firefox和Chrome上收到两种不同的响应

I have copied the plugin's css straight into the css of the files I'm working with (so it becomes just part of the native css) so I have better control over it. 我已经将插件的css直接复制到了我正在使用的文件的css中(因此它只是本机css的一部分),因此我可以更好地控制它。

I've modified this new pasted css slightly from the original script slick.css file, but only by modifying one the display: none; 我已经从原始脚本slick.css文件中稍微修改了这个新粘贴的CSS,但是只修改了一个display: none; to display: grid; display: grid; on the .slick-list selector. .slick-list选择器上。 This deals with the issue on Firefox, but not on Chrome. 这可以解决Firefox上的问题,但不能解决Chrome上的问题。

All code that I am using is located here. 我正在使用的所有代码都位于此处。 I have added one line of code background-color: red; 我添加了一行代码background-color: red; to the .slick-list selector to illustrate the space that SHOULD be taken up by slides that are shorter than the tallest slide: https://codepen.io/kyleshepherddev/pen/eqMOxm .slick-list选择器以说明比最高的幻灯片短的幻灯片应占用的空间: https//codepen.io/kyleshepherddev/pen/eqMOxm

I'm not sure what I'm expecting - the css I'm using may not be the right way to fix the problem. 我不确定我期望什么-我正在使用的CSS可能不是解决问题的正确方法。 We have a client who used this plugin on their site, and I'm mucking around trying to figure out exactly how to fix it. 我们有一个客户在他们的网站上使用了此插件,我正在想办法弄清楚如何修复它。 The content of the slider shifts a bit from slide to slide, so the goal is to make ALL slides the SAME HEIGHT as the slide with the most content in it. 滑块的内容在幻灯片之间会有所不同,因此目标是使所有幻灯片的高度相同,成为其中内容最多的幻灯片。

Works like a charm in Firefox; 在Firefox中像魅力一样工作; doesn't work at all in Chrome. 在Chrome中根本无法使用。

Simple update these two classes: 简单更新这两个类:

.slick-list to display: flex instead of display: grid .slick-list display: flex而不是display: grid

.slick-track to display: flex instead of display: block .slick-trackdisplay: flex代替display: block

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM