背景:通过h5c3+js使用HBuild制作移动端交互h5,在谷歌浏览器完全显示移动端内容
问题:1.怎么才能实现网页缩放时,图片+存放盒子也能等比例缩放
2.怎么确定盒子的高度宽度(因为我要通过定位居中盒子在里面写别的小组件)
<body>
<div class="index">
<div class="tp">
<img src="./img/1.png" alt="">
</div>
<div class=""></div>
</div>
</body>
<style>
html{
font-size: 14px;
}
body{
max-width: 520px;
margin: 0 auto;
padding: 0;
background-color: bisque;
text-align: center;
}
.index{
margin: 0 auto;
}
.tp img{
height: 100vh;
vertical-align: bottom;
}
.tp{
height:0;
padding-bottom:56.25%; /* 16:9 */
position:relative;
width:100%;
}
</style>
媒体查询 rem