html - 溢出-x : scroll not working

标签 html css

我有一个内部有 float (左)图像的 div,但是 overflow-x : scroll; 似乎不起作用..

这是我的容器:

.browse-gallery {
    width: 100%;
    height: 110px;
    overflow-x: scroll;
    overflow-y: hidden;
    border-top: 7px solid #585453;
    background: #585453;
    white-space: nowrap;
    float: left;
}

和图像:

.browse-gallery img {
    width: 109px;
    height: 81px;
    display: block;
    border-top: none;
    float: left;
    position: relative;
    cursor: pointer;
    margin-right: 5.7px;
    white-space: nowrap;
}

我该如何解决这个问题?谢谢。

最佳答案

删除 float 并添加显示:内联 block : Demo

.browse-gallery img {
        width: 109px;
        height: 81px;
        display: inline-block;
        border-top: none;
        /*float: left;*/
        position: relative;
        cursor: pointer;
        margin-right: 5.7px;
        white-space: nowrap;
        background:#fff;
    }

关于html - 溢出-x : scroll not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22499187/

相关文章:

javascript - 使用 jquery 单击另一个链接时更新链接

javascript - HTML 打开弹出窗口,无需用户点击

css - compass 中的自定义动画?

html - 顶栏附加到左侧栏

javascript - transitionend 事件错误无法正确删除 CSS 类

添加文本时 HTML 表格单元格下降

javascript - 如何重定向 Google 协作平台上的 URL

javascript - 如何使叠加效果与图像响应

css - 如何在 bootstrap 中获得两列布局,左边有 2 行

html - 如何实现横向卡片样式