Horizontal scroll css?

后端 未结 5 2071
礼貌的吻别
礼貌的吻别 2020-12-23 19:35

I want to have one

with id that has horizontal scroll, but the problem is it has to be responsive, not with fixed width.



        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 20:28

    I figured it this way:

    * { padding: 0; margin: 0 }
    body { height: 100%; white-space: nowrap }
    html { height: 100% }
    
    .red { background: red }
    .blue { background: blue }
    .yellow { background: yellow }
    
    .header { width: 100%; height: 10%; position: fixed }
    .wrapper { width: 1000%; height: 100%; background: green }
    .page { width: 10%; height: 100%; float: left }
    
    

    I have the wrapper at 1000% and ten pages at 10% each. I set mine up to still have "pages" with each being 100% of the window (color coded). You can do eight pages with an 800% wrapper. I guess you can leave out the colors and have on continues page. I also set up a fixed header, but that's not necessary. Hope this helps.

提交回复
热议问题