是通过给body设置固定定位实现的,以及去除元素的内外边距
复制以下代码,你可以预览一下(亲测无误)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
outline: none;
box-sizing: border-box;
margin:0;
padding:0;
-webkit-tap-highlight-color: rgba(255,255,255,0);
}
body{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: #000;
}
.box img{
width:100%;
}
</style>
</head>
<body>
<div class="box">
<img src="https://iknowpc.bdimg.com/static/home/widget/partner/banner/img/banner-bg.e9122b7.png" alt="">
</div>
</body>
</html>
如图