Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:看上去不错哟
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PC端布局方案</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
a {
text-decoration: none;
color: #ccc;
}
body {
display: flex;
/* 垂直流不换行 */
flex-flow: column nowrap;
}
.container {
display: flex;
min-height: 300px;
margin: 10px auto;
/* 居中对齐 */
justify-content: center;
}
.container > aside,
.container > main {
padding: 10px;
}
.container > aside {
flex: 0 0 200px;
}
.container > main {
flex: 0 0 450px;
margin: 0 10px;
}
header,
footer {
height: 50px;
border: 1px dashed #000;
}
header {
display: flex;
/* 所有项目在交叉轴方向上垂直居中 */
align-items: center;
}
header a {
flex: 0 1 100px;
text-align: center;
}
header a:first-of-type {
margin-right: 50px;
}
header > a:last-of-type {
margin-left: auto;
}
header a:hover:not(:first-of-type) {
color: pink;
}
footer {
text-align: center;
}
footer {
display: flex;
/* 主轴方向水平且不换行 */
flex-flow: column nowrap;
/* text-align: center; */
}
</style>
</head>
<body>
<header>
<a href="">logo</a>
<a href="">首页</a>
<a href="">栏目1</a>
<a href="">栏目2</a>
<a href="">栏目3</a>
<a href="">登陆</a>
</header>
<div class="container">
<aside>左边栏</aside>
<main>主题内容区</main>
<aside>右边栏</aside>
</div>
<footer>
php中文网©版权所有 (2020-2030)|备案号:安-00001号
<p><a href=""></a></p>
<p>中国合肥 | 电话+86 -0551 88888888</p>
</footer>
</body>
</html>
直接上代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>移动端布局 仿京东</title>
<link rel="stylesheet" href="./css/font-icon.css" />
<link rel="stylesheet" href="./css/common.css" />
<style>
html{
width: 100vw;
height: 100vh;
font-size: 14px;
}
body{
display:flex;
flex-flow: column wrap;
background-color: #eeeeee;
/* position: relative; */
}
/* --------------------菜单栏-------------------------- */
header{
/* 转为弹性布局 */
display: flex;
/* 水平不换行 */
flex-flow: row nowrap;
/* 背景色 */
background-color: rgb(51, 51, 51);
/* 宽高 */
height: 32px;
width: 100vw;
/* 可放大 可收缩 尺寸自动 */
flex-flow: 1 1 auto;
/* 两端对齐 */
justify-content: space-between;
/* 上下居中 */
align-items: center;
/* 调整内边距 */
padding:0 20px;
position: fixed;
}
header>*{
/* 设置大小和颜色 */
font-size:1.2rem;
color: #eee;
}
/* --------------------轮播图------------------------ */
.banner{
width: 100vw;
}
.banner>img{
width: 100vw;
}
/* --------------商品主导航--------------------- */
/* 主导航栏 nav >div >a >img p */
nav{ */
display:flex;
/* 水平 自动换行 */
flex-flow: row wrap;
/* 宽度可视区100% */
width: 100vw;
/* 可放大 可收缩 尺寸自动 */
flex: 1 1 auto;
}
nav>div{
margin: 10px 0;
display:flex;
/* 水平自动换行 */
flex-flow: row wrap;
}
nav>div>a{
display: flex;
width: 20vw;
flex-flow: row wrap;
flex: 1 1 auto;
align-items: center;
margin: 7px 0;
}
nav>div>a>img{
width: 40%;
/* height:auto; */
}
nav>div>a{
display:flex;
flex-flow:column nowrap;
flex: 1 1 auto;
}
/* -------------热销商品大标题---------div>h1+span-------------------------- */
.rxtitle{
display: flex;
flex:1 1 auto;
align-items: center;
color:rgb(252, 94, 94);
/* width: 96vw; */
/* margin: 0 50px; */
margin: 10px 20px;
}
/* ----hoot-goods">hoot-goods-one-----------------热销商品------------------------------------ */
.hoot-goods{
width: 96vw;
display:flex;
flex-flow: row wrap;
flex:1 1 auto;
align-items: center;
justify-content: center;
margin: 10px auto;
border-radius: 5px;
/* position: relative; */
}
/* 图片和标题 */
.hoot-goods-one{
background-color: #fff;
display: flex;
flex-flow: column wrap;
flex: 1 1 auto;
width: 45vw;
font-size: 0.7rem;
margin: 2px;
border-radius: 5px;
}
.hoot-goods-one:hover{
color:chartreuse;
}
/* 购物车和价格 */
.hoot-goods-jiage{
display: flex;
flex-flow: row wrap;
justify-content: center;
width: 50vw;
color: red;
}
/* 商品图和名称 */
.hoot-goods-one>a{
width: 48vw;
display: flex;
flex-flow: column wrap;
align-items: center;
}
/* 商品名 */
.hoot-goods-one>a>p{
padding: 3px 0;
}
/* 商品图 */
.hoot-goods-one>a>img{
width: 30vw;
display: flex;
flex: 1 1 auto;
padding: 10px 0;
}
.list-title{
/* background-color: rgb(116, 116, 116); */
width: 100vw;
height: 50px;
text-align: center;
line-height: 50px;
}
/* ---------------------------列表商品------------------ */
.last-goods{
display: flex;
flex-flow: row wrap;
flex-flow: 1 1 auto;
width: 96vw;
margin: 0 auto;
/* align-content: center; */
}
.last-goods-one{
display: flex;
flex-flow: row wrap;
flex-flow: 1 1 auto;
width: 96vw;
/* margin: 10 0; */
background-color: #fff;
align-content: center;
border-radius: 3px;
margin: 1px auto;
}
.last-goods-one>a{
margin: 15px 0;
display: flex;
flex-flow: row wrap;
flex: 1 1 auto;
/* width: 100vw; */
width: 40vw;
text-align: center;
align-items: center;
justify-content: space-between;
justify-content: center;
justify-content: space-evenly;
}
.last-goods-one>a>*{
width: 40vw;
text-align: center;
}
/* ------------footer-------------------------- */
footer{
/* 转为flex */
display: flex;
flex-flow: row nowrap;
flex: 1 1 auto;
min-height: 30px;
background-color: black;
/* 居中 */
justify-content: center;
/* 分散对齐 */
justify-content: space-evenly;
align-items: center;
}
footer>*{
color: #fff;
}
footer>a>*:hover{
color: pink;
}
</style>
</head>
<body>
<!-- headr -->
<header>
<a href="">logo</a>
<span class="iconfont"></span>
</header>
<!-- 轮播图 -->
<div class="banner">
<img src="./images/banner.jpg" alt="" />
</div>
<!-- 主导航 -->
<nav>
<div>
<a href="">
<img src="./images/chaoshi.png" alt="" />
<p>京东超市</p>
</a>
<a href="">
<img src="./images/shumadianqi.png" alt="" />
<p>数码电器</p>
</a>
<a href="">
<img src="./images/jingdongfushi.png" alt="" />
<p>京东服饰</p>
</a>
<a href="">
<img src="./images/jingdongshengxian.png" alt="" />
<p>京东生鲜</p>
</a>
<a href="">
<img src="./images/dongjia.png" alt="" />
<p>京东到家</p>
</a>
<a href="">
<img src="./images/chongzhijiaofei.png" alt="" />
<p>充值缴费</p>
</a>
<a href="">
<img src="./images/9.9yuanpin.png" alt="" />
<p>9.9元拼</p>
</a>
<a href="">
<img src="./images/lingquan.png" alt="" />
<p>领券</p>
</a>
<a href="">
<img src="./images/zhuanqian.png" alt="" />
<p>赚钱</p>
</a>
<a href="">
<img src="./images/plus.png" alt="" />
<p>PLUS会员</p>
</a>
</nav>
<!-- 热销商品 标题 --------------------------------------------------------------->
<div class="rxtitle">
<h1 class="rxsphead">热销商品
</h1><span class="iconfont huo"></span>
</div>
<!-- 热销商品大盒子 -------------------------------------------->
<div class="hoot-goods">
<!-- - 热销单个商品 -start-> -->
<div class="hoot-goods-one">
<a href="" >
<img src="./images/goods1.jpg" alt="">
<p>Apple iPhone 11 128G</p></a>
<div class="hoot-goods-jiage">
<!-- 价格购物车 -->
<span>1888元</span>
<span class="iconfont huo"></span>
</div>
</div>
<!-- 热销单个end -->
<!-- - 热销单个商品 -start-> -->
<div class="hoot-goods-one">
<a href="" >
<img src="./images/goods2.jpg" alt="">
<p>联想100核电脑</p></a>
<div class="hoot-goods-jiage">
<!-- 价格购物车 -->
<span>1888元</span>
<span class="iconfont huo"></span>
</div>
</div>
<!-- 热销单个end -->
<!-- - 热销单个商品 -start-> -->
<div class="hoot-goods-one">
<a href="" >
<img src="./images/goods3.jpg" alt="">
<p>滚筒洗衣机</p></a>
<div class="hoot-goods-jiage">
<!-- 价格购物车 -->
<span>1888元</span>
<span class="iconfont huo"></span>
</div>
</div>
<!-- 热销单个end -->
<!-- - 热销单个商品 -start-> -->
<div class="hoot-goods-one">
<a href="" >
<img src="./images/goods4.jpg" alt="">
<p>华为P80手机</p></a>
<div class="hoot-goods-jiage">
<!-- 价格购物车 -->
<span>1888元</span>
<span class="iconfont huo"></span>
</div>
</div>
<!-- 热销单个end -->
<!-- 热销单个end -->
<!-- - 热销单个商品 -start-> -->
<div class="hoot-goods-one">
<a href="" >
<img src="./images/goods5.png" alt="">
<p>vivoX21 PLUS</p></a>
<div class="hoot-goods-jiage">
<!-- 价格购物车 -->
<span>1888元</span>
<span class="iconfont huo"></span>
</div>
</div>
<!-- 热销单个end -->
<!-- 热销单个end -->
<!-- 热销单个end -->
<!-- - 热销单个商品 -start-> -->
<div class="hoot-goods-one">
<a href="" >
<img src="./images/goods6.webp" alt="">
<p>罗西尼手表</p></a>
<div class="hoot-goods-jiage">
<!-- 价格购物车 -->
<span>1888元</span>
<span class="iconfont huo"></span>
</div>
</div>
<!-- 热销单个end -->
</div>
<!-- 热销单个end -->
<!-- ---------商品列表大标题------- -->
<h2 class="list-title">商品列表<span class="iconfont hot" style="color: coral; font-size: 1.5rem;"></span></h2>
</body>
</html>
<!-- ---------------------------商品列表------------------------ -->
<!-- start------------------------------------ -->
<div class="last-goods">
<div class="last-goods-one">
<a href="">
<img src="./images/goods6.webp" alt="">
<p>罗西尼手表罗西尼手表罗尼手表罗西尼手表罗西尼手表罗西</p>
</a>
</div>
<!-- end----------------------------------------- -->
<!-- start------------------------------------ -->
<div class="last-goods">
<div class="last-goods-one">
<a href="">
<img src="./images/goods6.webp" alt="">
<p>罗西尼手表罗西尼手表罗尼手表罗西尼手表罗西尼手表罗西</p>
</a>
</div>
<!-- end----------------------------------------- -->
<!-- start------------------------------------ -->
<div class="last-goods">
<div class="last-goods-one">
<a href="">
<img src="./images/goods6.webp" alt="">
<p>罗西尼手表罗西尼手表罗尼手表罗西尼手表罗西尼手表罗西</p>
</a>
</div>
<!-- end----------------------------------------- -->
<!-- start------------------------------------ -->
<div class="last-goods">
<div class="last-goods-one">
<a href="">
<img src="./images/goods6.webp" alt="">
<p>罗西尼手表罗西尼手表罗尼手表罗西尼手表罗西尼手表罗西</p>
</a>
</div>
<!-- end----------------------------------------- -->
<!-- start------------------------------------ -->
<div class="last-goods">
<div class="last-goods-one">
<a href="">
<img src="./images/goods6.webp" alt="">
<p>罗西尼手表罗西尼手表罗尼手表罗西尼手表罗西尼手表罗西</p>
</a>
</div>
<!-- end----------------------------------------- -->
<!-- -----------------footer---------------------------- -->
<footer>
<a href="">
<span class="iconfont hot">首页</span>
</a>
<a href="">
<span class="iconfont hot">分类</span>
</a>
<a href="">
<span class="iconfont hot">购物车</span>
</a>
<a href="">
<span class="iconfont hot">未登录</span>
</a>
</footer>
</body>
实际效果