1.首先是我的效果图
2.下面是我的html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/index-hd.css">
<title>m.php.cn手机端首页</title>
</head>
<body>
<header>
<img src="img/user_avatar.jpg" alt="头像">
<img src="img/logo.png" alt="官网logo">
<a href="">阿里图标</a>
</header>
<main>
<header><img src="" alt=""></header>
<nav>
<a href="">
<img src="img/html.png" alt="">
<span>Html/Css</span>
</a>
<a href="">
<img src="img/JavaScript.png" alt="">
<span>JavaScript</span>
</a>
<a href="">
<img src="img/code.png" alt="">
<span>服务器端</span>
</a>
<a href="">
<img src="img/sql.png" alt="">
<span>数据库</span>
</a>
</nav>
<nav>
<a href="">
<img src="img/app.png" alt="">
<span>移动端</span>
</a>
<a href="">
<img src="img/manual.png" alt="">
<span>手册</span>
</a>
<a href="">
<img src="img/tool2.png" alt="">
<span>工具</span>
</a>
<a href="">
<img src="img/live.png" alt="">
<span>直播</span>
</a>
</nav>
<section>
<h2>推荐课程</h2>
<div>
<section><a href=""><img src="img/1230.jpg" alt=""></a></section>
<section><a href=""><img src="img/1230.jpg" alt=""></a></section>
</div>
<article>
<section><a href=""><img src="img/1231.jpg" alt=""></a></section>
<section>
<a href="">CI框架30分钟极速入门</a>
<span><i>中级</i><a>123次播放</a></span>
</section>
</article>
<article>
<section><a href=""><img src="img/1232.jpg" alt=""></a></section>
<section>
<a href="">2019前端入门_HTML5</a>
<span><i>初级</i><a>345播放</a></span>
</section>
</article>
</section>
</main>
<footer>
</footer>
</body>
</html>
3.下面的是我的css组件
@import "reset.css";
body > header {
/*转为Flex*/
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
body > header > img:first-of-type,
body > header > img:last-of-type {
height: 26px;
margin: 10px;
}
body > header > img:nth-of-type(2){
height: 40px;
}
body > header > img:first-of-type {
border-radius: 50%;
}
body > header > a {
font-size: 17px;
}
body > header {
background-color: #22282d;
}
body > main {
flex-grow: 1;
overflow: auto;
display: flex;
flex-direction: column;
}
/*轮播*/
body > main > header > img {
width: 100vw;
}
/*导航区*/
body > main > nav {
background-color: lightsteelblue;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-content:space-between;
}
body > main > nav > a {
display: flex;
flex-flow: column wrap;
align-content: center;
text-align: center;
margin: 5px;
text-decoration: none;
}
body > main > nav > a > img {
width: 9vh;
margin: 2px;
}
/*主体内容区*/
body > main > section {
display: flex;
flex-direction: column;
}
/*内容区的标题*/
body > main > section > h2 {
padding: 2vh;
}
/*内容区的图文列表详情*/
body > main > section > article {
display: flex;
flex-direction: row;
margin: 1vh 0;
}
body > main > section > div {
display: flex;
flex-direction: row;
margin: 1vh 0;
justify-content: center;
}
/* 2张图片对齐显示 */
body > main > section > div > section {
display: flex;
flex-direction: column;
}
body > main > section > div > section > a >img {
width: 50vw;
padding-left: 2vw;
}
/* 内容区域图文列表详情 */
body > main > section > article {
display: flex;
flex-direction: row;
margin: 1vh 0;
background-color: #fff;
margin-left: 1vw;
}
body > main > section > article > section{
display: flex;
flex-direction: column;
justify-content: space-around;
flex:1;
margin-left: 1vw;
}
body > main > section > article > section > a{
margin: 1vh 1vw;
}
body > main > section > article > section > a > img {
height: 15vh;}
4.小结
感觉自己做的比较慢,照着老师做,但还是出现一些问题,最后还好找出来了,总体的页面效果,基本已经实现,还有一些细节的东西,我还会再改进的。