使一张图片沾满整个屏幕且不带滚动条

效果图:

代码:

<!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>

<body>
    <div class="content no-msg top">
        <img class="back" src="../assets/images/back.jpeg" alt="">
        <img class="scan" src="../assets/images/scan.png" alt="">
    </div>
</body>
<style>
html,body {
    margin:0;
    padding:0;
    overflow: hidden;
}

.no-msg{
        width: 100%;
        height: 100%;
        top:0;
        z-index: 1;
        position: absolute;
    }
    .no-msg .back {
        display: block;
        outline: none;
        border:0;
        height: 100%;
        width: 100%;
    }
    .scan{
        z-index: 1000000000;
        position: absolute;
        top: 40%;
        left: 33%;
        width: 34%;
        /* height: 20%; */
    }
</style>
</html>

 

posted @ 2020-05-05 15:13  小那  阅读(203)  评论(0编辑  收藏  举报