html - 宽度 :auto in firefox is not working as intended

标签 html css

所以,我有一个包裹在 div 中的图像 (.indexWrap):

<div id = "slider">      
<div class="indexWrap">                 
        <img class="indexImage" src="">                             
       </div>
</div>

在名为 #slider 的 div 中通过 php 在页面加载时创建了其中的 8 个。我正在使用 smooth Div Scroll在主页上显示这些图像。在 Chrome 中一切看起来都很好,在 IE 8 和 9 中看起来也不错。问题出在 firefox 中。每个图像的 div.indexWrap 的自动宽度设置不正确。 div 似乎向右额外拉伸(stretch)了 200-300 像素。这是 CSS:

#slider{
    position: relative;
    top:50px;
    width:100%;
    height:275px;
}
div.scrollWrapper
{
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

div.scrollableArea
{
    position: relative;
    width: auto;
    height: 100%;
}
.indexWrap{
    float:left; 
    position:relative;
    width:auto;
    height:100%;

    padding-right:50px;
    padding-left:50px;
}
img.indexImage{
    float:left;
    position:relative;
    width:auto;
    height:100%;
}  

这里是有问题的实时版本的链接:jasone.co

编辑: 最重要的是,在页面加载时,每个 div.indexWrap 都没有被正确填充,但是随着滚动的开始,下一个检索到的元素被正确地填充了,有点蹩脚。可能是这一切的原因。

最佳答案

尝试添加display: inline-block;

关于html - 宽度 :auto in firefox is not working as intended,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11534248/

相关文章:

javascript - 阻止 <div> 以避免与内容交互

html - 将 6 个图像彼此相邻对齐响应式 Bootstrap

html - 视口(viewport)中的中心 slider

javascript - 我如何将文本发送到另一行,我有一张图片然后是文本。如果文本太长,我希望文本位于第一行文本下方

html - CSS仅更改子菜单的背景颜色

javascript - 退出窗口弹出消息以使用样式 css 进行自定义

css - 计算 div 的高度并将该数字放在::伪元素内容之后

javascript - 在子类中随着文本的增长垂直居中

javascript - 如何检测 salesforce lightning 应用程序是在移动浏览器还是桌面浏览器上运行?

html - 使用 HTML 5 完成客户端应用程序