如何让一张图片在手机端页面占满整个屏幕不带滚动条(示例)

来源:互联网 发布:vb读取excel单元格 编辑:程序博客网 时间:2024/04/29 07:30
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
    name="viewport">
    <title>测试页面</title>
</head>
<style>
html,body {
    margin:0;
    padding:0;
    overflow: hidden;
}
.content {
    width: 100%;
    height: 100%;
    top:0;
    z-index: -1;
    position: absolute;
}

.content img {
    display: block;
    outline: none;
    border:0;
    height: 100%;
    width: 100%;
}
</style>
<body>
    <div class="content">
        <img alt="评价成功" src="../static/images/comsuccess.jpg">
    </div>
</body>

</html>


总结:

         善用overflow: hidden;


参考资料:http://zhidao.baidu.com/link?url=0UO_tukSpZ7KDRLAN0_fgrfog0_80aYwLG3UJsjxQcgqjKZurjELaAacnF9Wu8IIZH5mtjlhXYfBE_JIAPD14LhwOVyqnMp2A3M9-8gE5-W



0 0