Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
width=device-width
inintial-scale=1.0
px
转换成rem
100px=100vw/1vw=100vw/(375/100)=100vw/3.75
body {
font-size: 0.16rem;
}
Layout viewport
980px
,显示完整网页visual viewport
idea viewport
<!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.0" />
<title>手机页面布局整体架构</title>
<link rel="stylesheet" href="css/reset.css" />
<style>
/* 顶部 */
header {
position: relative;
}
/* logo和搜索框布局 */
header .top {
position: fixed;
display: flex;
width: 100vw;
justify-content: space-between;
padding: 0.05rem 0.15rem;
background-color: rgb(228, 114, 8);
}
/* 设置一下搜索框宽度 */
header .top .search input {
width: 70vw;
}
/* 把轮播图的位置设置出来 */
header .carousel {
position: absolute;
top: 0.29rem;
height: 1.17rem;
}
/* 轮播图设置宽度 */
header .carousel img {
width: 100vw;
}
/* 导航组 */
header .nav {
position: absolute;
top: calc(0.29rem + 1.17rem);
height: 1.5rem;
display: grid;
width: 100vw;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(2, 1fr);
place-items: center;
}
/* 主体部分 */
main {
position: relative;
top: calc(0.29rem + 1.17rem + 1.5rem);
padding: 0.1rem;
}
/* 主体部分字体颜色等 */
main div {
color: red;
font-size: 0.3rem;
font-weight: bolder;
text-align: center;
}
/* 底部菜单栏做个固定定位 */
footer {
position: fixed;
top: calc(100vh - 0.46rem);
background-color: #fff;
}
/* 底部布局 */
footer .menu {
display: flex;
width: 100vw;
height: 0.46rem;
justify-content: space-around;
align-items: center;
}
</style>
</head>
<body>
<!-- 页眉 -->
<header>
<div class="top">
<!-- 顶部logo和搜索框等 -->
<div class="logo">图标</div>
<div class="search">
<input type="search" placeholder="我是搜索框" />
</div>
</div>
<div class="carousel">
<!-- 轮播图 -->
<img src="image/1.jpg" alt="" />
</div>
<ul class="nav">
<li>分类1</li>
<li>分类2</li>
<li>分类3</li>
<li>分类4</li>
<li>分类5</li>
<li>分类6</li>
<li>分类7</li>
<li>分类8</li>
</ul>
</header>
<!-- 主体 -->
<main>
<!-- 主体内容,根据不同需要进行具体操作 -->
<div>
<p>我是主体1</p>
<p>我是主体2</p>
<p>我是主体3</p>
<p>我是主体4</p>
<p>我是主体5</p>
<p>我是主体6</p>
<p>我是主体</p>
<p>我是主体</p>
<p>我是主体</p>
<p>我是主体</p>
<p>我是主体</p>
<p>我是主体</p>
<p>我是主体</p>
<p>我是主体</p>
<p>我是主体</p>
<p>我是主体999</p>
</div>
</main>
<!-- 页脚 -->
<footer>
<!-- 底部菜单栏,一般是首页,我的等按钮 -->
<ul class="menu">
<li>菜单1</li>
<li>菜单2</li>
<li>菜单3</li>
<li>菜单4</li>
</ul>
</footer>
</body>
</html>