【问题标题】:how can i make height and width auto resize according the screen?如何根据屏幕自动调整高度和宽度?
【发布时间】:2014-08-24 10:55:11
【问题描述】:

这是我用来在移动应用项目中添加滚动文本的代码。

<style type="text/css">
     .scroll {      
         padding: 10px;      
         height: 280px;
         width: 580px; 
         overflow: scroll;
     }
</style>

<div class="scroll"> 
    <p>put paragraph here</p> 
</div>    `enter code here`

【问题讨论】:

    标签: html text scroll autoresize


    【解决方案1】:

    你可以如下使用:

    <style type="text/css">
         .scroll {      
             padding: 10px;      
    
             width: 100%; 
             overflow:auto;
            -webkit-overflow-scrolling: touch;
         }
    </style>
    

    查看JSFiddle

    【讨论】:

    • 你在移动端测试??
    • 尝试添加 -webkit-overflow-scrolling: touch;
    • 这对我没有帮助,我的朋友,我没那么先进。
    • 如果你想要简单的滚动然后使用我的答案中写的 css
    猜你喜欢
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-07
    • 1970-01-01
    • 1970-01-01
    • 2021-07-06
    相关资源
    最近更新 更多