1227号作业
效果图展示
HTML代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="moblie.css">
<title>移动端布局</title>
</head>
<body>
<div class="header">
<a href="" ><img src="static/images/ico/login.png" alt=""></a>
<a href="" ><img src="static/images/ico/logo.png" alt=""></a>
<a href="" ><img src="static/images/ico/login.png" alt=""></a>
</div>
<div class="main">
<div class="banner">
<img src="static/images/ico/2.jpg" alt="">
</div>
<div class="nav-1">
<div class="nav-list">
<a href=""><img src="static/images/ico/html.png" alt=""></a>
<span>HTML/CSS</span>
</div>
<div class="nav-list">
<a href=""><img src="static/images/ico/html.png" alt=""></a>
<span>HTML/CSS</span>
</div>
<div class="nav-list">
<a href=""><img src="static/images/ico/html.png" alt=""></a>
<span>HTML/CSS</span>
</div>
<div class="nav-list">
<a href=""><img src="static/images/ico/html.png" alt=""></a>
<span>HTML/CSS</span>
</div>
</div>
<div class="nav-2">
<div class="nav-list">
<a href=""><img src="static/images/ico/html.png" alt=""></a>
<span>HTML/CSS</span>
</div>
<div class="nav-list">
<a href=""><img src="static/images/ico/html.png" alt=""></a>
<span>HTML/CSS</span>
</div>
<div class="nav-list">
<a href=""><img src="static/images/ico/html.png" alt=""></a>
<span>HTML/CSS</span>
</div>
<div class="nav-list">
<a href=""><img src="static/images/ico/html.png" alt=""></a>
<span>HTML/CSS</span>
</div>
</div>
<div class="article">
<div class="section-tuijian">
<h3>推荐视频</h3>
<div class="banner-1">
<a href=""><img src="static/images/ico/tian.jpg" alt=""></a>
<a href=""><img src="static/images/ico/tian.jpg" alt=""></a>
</div>
<div class="banner-2">
<div class="banner-list">
<a href=""><img src="static/images/ico/HTML5.jpg" alt=""></a>
<div class="banner-list-intro">
<a href="">CI框架30分钟极速入门</a>
<div>
<span>中级</span>
<span>56179次播放</span>
</div>
</div>
</div>
<div class="banner-list">
<a href=""><img src="static/images/ico/HTML5.jpg" alt=""></a>
<div class="banner-list-intro">
<a href="">2018前端入门_HTML5</a>
<div>
<span>初级</span>
<span>56179次播放</span>
</div>
</div>
</div>
</div>
</div>
<div class="section-new-update">
<h3>最新更新</h3>
<div class="banner-list">
<a href=""><img src="static/images/ico/new1.png" alt=""></a>
<div class="banner-list-intro">
<a href="">PHP快速操控Excel之PhpSpreadsheet</a>
<span>老的PHPExcel已经停止更新了!目前最新的是使用phpOffice插件PhpSpreadshe...</span>
<div>
<span>中级</span>
<span>56179次播放</span>
</div>
</div>
</div>
</div>
<div class="section-new-article">
<h3>最新文章</h3>
<div class="banner-list-intro">
<div>
<a href="" >如何设置vscode打开文件时新建窗口</a>
<a href="" >发布时间:2019-12-30</a>
</div>
<div class="banner-list">
<a href=""><img src="static/images/ico/art1.jpg" alt=""></a>
</div>
</div>
<a href="">更多内容</a>
</div>
<div class="section-new-bowen">
<h3>最新博文</h3>
<div>
<a href="">php核心特性 - 错误处理</a>
<span>2020年01月04日</span>
</div>
<a href="">更多内容</a>
</div>
</div>
</div>
<div class="footer">
<div>
<a href="" >
<img src="static/images/ico/login.png" alt="">首页
</a>
</div>
<div>
<a href="" >
<img src="static/images/ico/login.png" alt="">登录
</a>
</div>
<div>
<a href="" >
<img src="static/images/ico/login.png" alt="">视频
</a>
</div>
<div>
<a href="" >
<img src="static/images/ico/login.png" alt="">其他
</a>
</div>
</div>
</body>
</html>
CSS代码
@import "public_reset.css";
body{
width: 768px;
/*height: 100vh;*/
}
body > .main {
flex: 1;
/*超出页面显示,增加滚动条*/
overflow: auto;
display: flex;
flex-direction: column;
}
/*头部样式*/
body > .header{
display: flex;
height: 42px;
background-color: black;
justify-content: space-between;
}
body > .header > a{
display: flex;
width: 25px;
height: 25px;
align-self: center;
}
body > .header > a:nth-child(2) {
width: auto;
height: 42px;
}
/*轮播图样式*/
body > .main >.banner > img{
display: flex;
width: 768px;
height: 150px;
}
/*导航栏样式*/
body > .main > .nav-1{
display: flex;
flex-flow: row wrap;
justify-content: space-evenly;
background-color: white;
}
body > .main > .nav-2{
display: flex;
flex-flow: row wrap;
justify-content: space-evenly;
padding-bottom: 10px;
background-color: white;
}
body > .main > .nav-1 > .nav-list{
display: flex;
flex-flow: column;
justify-content: space-evenly;
}
body > .main >.nav-2 > .nav-list{
display: flex;
flex-flow: column;
justify-content: space-evenly;
}
body > .main > .nav-1 > .nav-list > a{
display: flex;
width: 45px;
height: 49px;
align-self: center;
margin: 10px 0;
}
body > .main > .nav-2 > .nav-list > a{
display: flex;
width: 45px;
height: 49px;
align-self: center;
margin: 10px 0;
}
body > .main > .nav-1 > .nav-list span{
text-align: center;
}
body > .main > .nav-2 > .nav-list span{
text-align: center;
}
/*推荐视频样式*/
body > .main > .article > .section-tuijian{
display: flex;
flex-direction: column;
margin: 20px 0;
padding: 0 10px;
}
body > .main > .article > .section-tuijian h3{
padding-bottom: 10px;
}
body > .main > .article > .section-tuijian > .banner-1{
display: flex;
justify-content: space-between;
}
body > .main > .article > .section-tuijian > .banner-1 > a{
display: flex;
}
body > .main > .article > .section-tuijian > .banner-1 > a img{
height: 90px;
width: 366px;
}
body > .main > .article > .section-tuijian > .banner-list{
display: flex;
flex-direction: row;
}
body > .main > .article > .section-tuijian > .banner-2{
display: flex;
flex-direction: column;
}
body > .main > .article > .section-tuijian > .banner-2> .banner-list{
display: flex;
margin: 10px 0;
padding: 10px;
background-color: white;
}
body > .main > .article > .section-tuijian > .banner-2> .banner-list > a{
display: flex;
}
body > .main > .article > .section-tuijian > .banner-2> .banner-list > a img{
width: 295px;
height: 80px;
}
body > .main > .article > .section-tuijian > .banner-2> .banner-list > .banner-list-intro{
display: flex;
flex-direction: column;
justify-content: start;
margin-left: 20px;
flex: 1;
}
body > .main > .article > .section-tuijian > .banner-2> .banner-list > .banner-list-intro > div{
display: flex;
margin-top: 20px;
}
body > .main > .article > .section-tuijian > .banner-2> .banner-list > .banner-list-intro > div a{
font-size: 20px;
height: 50px;
}
body > .main > .article > .section-tuijian > .banner-2> .banner-list > .banner-list-intro > div span:first-of-type{
background-color: black;
color: white;
border-radius: 5px;
margin-right: 5px;
}
/*更新文章样式*/
body > .main > .article > .section-new-update{
display: flex;
flex-direction: column;
margin: 20px 0;
padding: 0 10px;
}
body > .main > .article > .section-new-update h3{
padding-bottom: 10px;
}
body > .main > .article > .section-new-update > .banner-list{
display: flex;
padding: 10px;
background-color: white;
}
body > .main > .article > .section-new-update > .banner-list >.banner-list-intro{
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 20px;
}
body > .main > .article > .section-new-update > .banner-list >.banner-list-intro > div{
display: flex;
justify-content: space-between;
}
body > .main > .article > .section-new-update > .banner-list >.banner-list-intro > div > span:first-of-type{
background-color: black;
border-radius: 5px;
color: white;
}
body > .main > .article > .section-new-update > .banner-list > a{
display: flex;
}
body > .main > .article > .section-new-update > .banner-list > a img{
width: 295px;
height: 80px;
}
/*最新文章样式*/
body > .main > .article > .section-new-article{
display: flex;
flex-direction: column;
margin: 20px 0;
padding: 0 10px;
}
body > .main > .article > .section-new-article > h3{
padding-bottom: 10px;
}
body > .main > .article > .section-new-article > .banner-list-intro{
display: flex;
justify-content: space-between;
padding: 10px;
background-color: white;
}
body > .main > .article > .section-new-article > .banner-list-intro > div{
display: flex;
flex-direction: column;
}
body > .main > .article > .section-new-article > .banner-list-intro > div a{
font-size: 15px;
}
body > .main > .article > .section-new-article > .banner-list-intro > div > a:first-of-type{
font-size: 15px;
font-weight: 900;
}
body > .main > .article > .section-new-article > .banner-list-intro > div > a:last-of-type{
padding-top: 10px;
box-sizing: border-box;
}
body > .main > .article > .section-new-article > .banner-list-intro > .banner-list > a img{
display: flex;
width: 219px;
height: 65px;
}
body > .main > .article > .section-new-article > a{
text-align: center;
background-color: #fff;
margin: 10px 0;
}
/*最新博文样式*/
body > .main > .article > .section-new-bowen {
display: flex;
flex-direction: column;
padding: 10px;
}
body > .main > .article > .section-new-bowen > h3{
padding: 10px;
}
body > .main > .article > .section-new-bowen > div{
display: flex;
justify-content: space-between;
padding: 10px;
background-color: #fff;
}
body > .main > .article > .section-new-bowen > a{
text-align: center;
background-color: #fff;
margin: 10px 0;
}
/*底部样式*/
body > .footer{
display: flex;
justify-content: space-around;
border-top: 1px gray solid;
}
body > .footer > div{
display: flex;
flex-direction: column;
text-align: center;
}
body > .footer > div > a{
display: flex;
flex-direction: column;
width: 45px;
height: 49px;
font-size: 15px;
padding-top: 10px;
}
在布局样式的时候,我添加了滚动条,但是一直没有出现,也百度了一下,现在还没有解决,没有找到问题所在。。。
老师,css和html应该也存在加载效率的问题吧?我总是感觉我写的东西不是最优的方案,感觉我的代码很冗余。哈哈。。。