CSS: series of floated elements without wrapping but rather scrolling horizontally

后端 未结 10 1617
无人及你
无人及你 2021-02-01 04:25

I\'m working on a album viewer. At the top I want a horizontal container of all the image thumbnails. Right now all the thumbnails are wrapped in a div with float:left

10条回答
  •  野的像风
    2021-02-01 04:30

    Instead of floating, try this:

    #thumbnails_container {
        height:75px;
        border:1px solid black;
        padding:4px;
        overflow-x:scroll;
        overflow-y: hidden;
    }
    .thumbnail {
        border:1px solid black;
        margin-right:4px;
        width:100px; height:75px;
        display: inline;
    }
    

    Remove the div { overflow:hidden; }, the rest stays the same.

    It's a bit simpler and they'll span across and scroll like you want.

提交回复
热议问题