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

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

    I know this is an old question now but this came up in a google search. I was trying to change a floated layout into a horizontal scrolled layout on mobile. None of the above worked for me. Instead I used the below which worked in my case:

        main
     {
        display: flex;
        max-width: 100%;
        overflow-x: auto;
     }
     
        main .thumbnail
     {
        width: 400px;
        flex-shrink: 0;
     }

提交回复
热议问题