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

后端 未结 10 1616
无人及你
无人及你 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:52

    How about using display: inline-block this way you can use borders on the block elements and get the horizontal scroll bar.

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

提交回复
热议问题