新传的一篇,微信小程序的:
======================================================
使用html和css简单的过一遍,微信小程序同理;
不熟悉定位的熟悉一下:https://blog.csdn.net/weixin_42067967/article/details/80152403;
使用定位的方式让div自动填满,如abc的样式就是红色局域,div自动填充;
只能帮到这里了。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Basic Communication</title>
<style>
.abc{
position: fixed;
top:50px;
left:50px;
right:50px;
bottom:100px;
background: #f00;
}
.def{
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
width:100px;
height:100px;
margin:auto;
background: #0f0;
}
</style>
</head>
<body>
<div class="abc">
<div class="def"></div>
</div>
</body>
</html>
实现效果如图:

|