仿php中文网首页
1.html代码部分:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>php中文网</title>
<link rel="stylesheet" href="static/style/layout.css">
<link rel="stylesheet" href="static/style/header.css">
<link rel="stylesheet" href="static/style/main-top.css">
<link rel="stylesheet" href="static/style/footer.css">
</head>
<body>
<header>
<a href="#" class="logo">
<span>php</span>
<span>中文网</span>
</a>
<ul>
<li><a href="">首页</a></li>
<li><a href="">视频教程</a></li>
<li><a href="">入门教程</a></li>
<li><a href="">社区问答</a></li>
<li><a href="">技术文章</a></li>
<li><a href="">资源下载</a></li>
<li><a href="">编程词典</a></li>
<li><a href="">工具下载</a></li>
<li><a href="">PHP培训</a></li>
</ul>
<div class="user">
<span>登陆</span>
<span>注册</span>
</div>
</header>
<main>
<div class="main-top">
<ul>
<li><a href=""><span>php开发</span><span>></span></a></li>
<li><a href=""><span>前端开发</span><span>></span></a></li>
<li><a href=""><span>服务端开发</span><span>></span></a></li>
<li><a href=""><span>移动开发</span><span>></span></a></li>
<li><a href=""><span>数据库</span><span>></span></a></li>
<li><a href=""><span>服务器维护&下载</span><span>></span></a></li>
<li><a href=""><span>在线工具箱</span><span>></span></a></li>
<li><a href=""><span>常用类库</span><span>></span></a></li>
</ul>
<div>
<ul>
<li><a href="">PHP头条</a></li>
<li><a href="">孤独九剑</a></li>
<li><a href="">学习路线</a></li>
<li><a href="">在线工具</a></li>
<li><a href="">趣味课堂</a></li>
<li><a href="">社区课堂</a></li>
<li><a href="">课程直播</a></li>
<li><input type="search"><span></span></li>
</ul>
<img src="./static/images/banner.jpg" alt="">
<div>
<a href=""><img src="static/images/1.jpg" alt=""></a>
<a href=""><img src="static/images/2.png" alt=""></a>
<a href=""><img src="static/images/3.jpg" alt=""></a>
<a href=""><img src="static/images/4.jpg" alt=""></a>
</div>
</div>
</div>
<div class="articles-list">
<div>
<h4>头条</h4>
<ul>
<li><a href="">文章标题列表文章名名字1</a></li>
<li><a href="">文章标题列表文章名名字2</a></li>
<li><a href="">文章标题列表文章名名字3</a></li>
<li><a href="">文章标题列表文章名名字4</a></li>
<li><a href="">文章标题列表文章名名字5</a></li>
<li><a href="">文章标题列表文章名名字6</a></li>
<li><a href="">文章标题列表文章名名字7</a></li>
<li><a href="">文章标题列表文章名名字8</a></li>
<li><a href="">文章标题列表文章名名字9</a></li>
<li><a href="">文章标题列表文章名名字10</a></li>
<li><a href="">文章标题列表文章名名字11</a></li>
</ul>
</div>
<div>
<h4>最新课程</h4>
<div>
<div>
<img src="static/images/article1.png" alt="">
<div>
<span>中级</span>
<p>通用后台管理系统实战开发实战开发</p>
</div>
</div>
<div>
<img src="static/images/article2.png" alt="">
<div>
<span>高级</span>
<p>ThinkPHP5.1企业站点快速开发快速开发</p>
</div>
</div>
<div>
<img src="static/images/article3.png" alt="">
<div>
<span>中级</span>
<p>ThinkPHP5.1企业站点快速开发</p>
</div>
</div>
<div>
<img src="static/images/article1.png" alt="">
<div>
<span>中级</span>
<p>ThinkPHP5.1企业站点快速开发</p>
</div>
</div>
<div>
<img src="static/images/article2.png" alt="">
<div>
<span>高级</span>
<p>ThinkPHP5.1企业站点快速开发</p>
</div>
</div>
<div>
<img src="static/images/article3.png" alt="">
<div>
<span>中级</span>
<p>ThinkPHP5.1企业站点快速开发</p>
</div>
</div>
</div>
</div>
<div>
<div>
<h4>常用手册</h4>
<h4>更多</h4>
</div>
<div>
<div>
<img src="static/images/article-logo.jpg" alt="">
<p>JavaScript参考手册JavaScript参考手册</p>
</div>
<div>
<img src="static/images/article-logo.jpg" alt="">
<p>JavaScript参考手册JavaScript参考手册</p>
</div>
<div>
<img src="static/images/article-logo.jpg" alt="">
<p>JavaScript参考手册JavaScript参考手册</p>
</div>
<div>
<img src="static/images/article-logo.jpg" alt="">
<p>JavaScript参考手册JavaScript参考手册</p>
</div>
<div>
<img src="static/images/article-logo.jpg" alt="">
<p>JavaScript参考手册JavaScript参考手册</p>
</div>
<div>
<img src="static/images/article-logo.jpg" alt="">
<p>JavaScript参考手册JavaScript参考手册</p>
</div>
</div>
</div>
</div>
<div class="container">
<span><i></></i><h3>php入门精品课程</h3><i></></i></span>
<img src="static/images/span2.jpg" alt="">
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
<div class="item">
<img src="static/images/article-detail.jpg" alt="">
<div>
<span><span>初级</span>2018前端入门_HTML5</span>
<span>18w次播放</span>
</div>
</div>
</div>
</main>
<footer>
<div class="content">
<ul>
<li><a href="">网站链接1</a></li>
<li><a href="">网站链接2</a></li>
<li><a href="">网站链接3</a></li>
<li><a href="">网站链接4</a></li>
<li><a href="">网站链接5</a></li>
<li><a href="">网站链接6</a></li>
<li><a href="">网站链接7</a></li>
<li><a href="">网站链接8</a></li>
<li><a href="">网站链接9</a></li>
</ul>
<p>php中文网:公益在线php培训,帮助PHP学习者快速成长!</p>
<p>Copyright 2014-2020 https://www.php.cn/ All Rights Reserved | 苏州跃动光标网络科技有限公司 | 苏ICP备2020058653号-1 </p>
<ul>
<li><a href="">关于我们1</a></li>
<li><a href="">关于我们1</a></li>
<li><a href="">关于我们1</a></li>
<li><a href="">关于我们1</a></li>
</ul>
<div class="logo-QR">
<img src="static/images/种业圈.jpg" alt="">
<img src="static/images/种业圈.jpg" alt="">
</div>
</div>
</footer>
</body>
</html>
2.css代码部分:
/*重置样式*/
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
a{
text-decoration: none;
}
ul{
list-style: none;
}
:root{
font-size: 16px;
}
/*整体页面布局样式*/
@import url("reset.css");
body{
background-color: #f3f5f7;
}
body > main{
/* outline: 1px solid red; */
width: 80vw;
min-height: 50rem;
margin: 0 auto;
}
/*导航条样式*/
@import url("reset.css");
header{
background-color: #000;
/* width: 100vw; */
min-width: 1400px;
height: 3.75rem;
display: grid;
grid-template-columns: 9rem 1fr 9rem;
place-content:center space-between;
grid-gap: 0.8rem;
color:#969896;
font-size: 1rem;
}
header > .logo{
display: flex;
justify-content: center;
align-items: center;
color:white;
padding-left: 0.8rem;
font-size: 1rem;
font-weight: 400;
}
header > .logo > span:first-of-type{
background-color: #fb4847;
color:white;
width: 3rem;
height: 2rem;
text-align: center;
line-height: 2rem;
font-size:1.2rem;
font-weight: bolder;
/* 通过设置背景圆角来绘制logo底色 */
border-bottom-left-radius:20rem 12rem;
border-bottom-right-radius:20rem 12rem ;
border-top-left-radius:20rem 12rem ;
border-top-right-radius:20rem 12rem ;
margin-right: 0.2rem;
}
header > ul {
display: flex;
justify-content: flex-start;
align-items: center;
/* height: 3.75rem; */
}
header > ul > li > a:hover{
/* background-color: rgba(255,255,255,.3); */
border-bottom:0.3rem solid green;
color:whitesmoke;
}
header > ul > li > a{
display: inline-block;
height: 3.75rem;
width: 6rem;
line-height: 3.75rem;
text-align: center;
color:#969896;
}
header > .user{
font-size: 1rem;
display: flex;
justify-content: space-evenly;
align-items: center;
font-weight: bolder;
}
header > .user > span {
height: 3.75rem;
width: 20rem;
line-height: 3.75rem;
text-align: center;
}
header > .user > span:hover{
background-color: rgba(255,255,255,.3);
/* border-bottom: 2px solid green; */
color:whitesmoke;
}
/*主题内容样式*/
@import url("reset.css");
main > .main-top {
margin-top:1.2rem ;
min-width: 78rem;
height: 33rem;
box-shadow: 0 0 10px lightslategrey;
border-radius: 0.5rem;
display: grid;
grid-template-columns: 12rem minmax(66rem,1fr);
}
main > .main-top > ul{
background-color: #2b333b;
border-top-left-radius:0.5rem ;
border-bottom-left-radius:0.5rem ;
display: flex;
flex-flow: column nowrap;
justify-content: space-evenly;
}
main > .main-top > ul > li > a{
display: flex;
width: 12rem;
height: 3.5rem;
line-height:3.5rem;
padding: 0 1rem;
justify-content: space-between;
font-size: 1.1rem;
color:lightslategray;
}
main > .main-top > ul > li > a:hover{
background-color: rgba(255,255,255,.3);
color: white;
}
main > .main-top > div >ul{
display: flex;
/* flex-flow: row nowrap; */
/* background-color: #fff; */
/* width:60rem ; */
}
main >.main-top > div > ul{
display: flex;
justify-content: space-around;
height: 3.5rem;
align-items: center;
}
main >.main-top > div > img{
width:66rem;
}
main >.main-top > div > div {
padding-top:0.5rem ;
display: flex;
justify-content: space-around;
}
main >.main-top > div > div > a >img{
width: 16rem;
border-radius: 1rem;
}
/* 文章列表区 */
main > .articles-list {
margin-top: 1.5rem;
min-width: 78rem;
height: 24rem;
display: grid;
grid-template-columns: 19rem 40rem 17rem;
/* box-shadow: 0 0 10px lightslategrey;
border-radius: 0.5rem; */
grid-gap: 1rem;
margin-bottom: 1.5rem;
}
main > .articles-list >div:first-of-type{
box-shadow: 0 0 10px lightslategrey;
border-radius: 0.5rem;
}
main > .articles-list >div:first-of-type > h4{
height: 2.5rem;
/* background-color: red; */
line-height: 2.5rem;
margin: 0 1rem;
padding-left:1rem ;
border-bottom: 1px solid #969896;
}
main > .articles-list >div:first-of-type > ul{
height: 21.5rem;
display: flex;
flex-flow: column nowrap;
justify-content: space-evenly;
padding-left:1rem ;
}
main > .articles-list >div:first-of-type > ul a {
color:#778899;
}
main > .articles-list > div:nth-of-type(2){
box-shadow: 0 0 10px lightslategrey;
border-radius: 0.5rem;
}
main > .articles-list > div:nth-of-type(2) > div{
display: grid;
height: 21.5rem;
grid-template-columns: repeat(3,13rem);
grid-template-rows:repeat(2,10rem);
place-content:center center;
place-items: center center;
}
main > .articles-list > div:nth-of-type(2) > div > div{
width: 12rem;
/* background-color: red; */
space-self:center center;
padding-top: 1rem;
/* position: relative; */
}
main > .articles-list > div:nth-of-type(2) > div > div > div > * {
display: inline;
/* background-color: lightblue; */
font-size: 0.8rem;
}
main > .articles-list > div:nth-of-type(2) > div > div > div {
height: 4rem;
padding: 0.2rem;
background-color: #fff;
border-radius: 0.5rem;
position: relative;
top:-1.5rem;
/* line-height: 4rem; */
}
main > .articles-list > div:nth-of-type(2) > div > div > div> span{
background-color: #708090;
/* width: 6rem; */
padding: 0 0.2rem;
border-radius: 0.5rem;
}
main > .articles-list >div:nth-of-type(2) > h4{
height: 2.5rem;
/* background-color: red; */
line-height: 2.5rem;
margin: 0 1rem;
padding-left:1rem ;
border-bottom: 1px solid #969896;
}
main > .articles-list > div:nth-of-type(2) img{
width: 12rem;
height: 6rem;
display: block;
border-radius: 0.5rem;
}
main > .articles-list > div:last-of-type{
box-shadow: 0 0 10px lightslategrey;
border-radius: 0.5rem;
}
main > .articles-list > div:last-of-type > div:first-child {
line-height: 2.5rem;
margin: 0 1rem;
padding:0 1rem ;
border-bottom: 1px solid #969896;
}
main > .articles-list >div:last-of-type > div:last-of-type{
height: 21.5rem;
display: flex;
flex-flow: column nowrap;
justify-content: space-evenly;
padding-left:1rem ;
}
main > .articles-list > div:last-of-type img {
width: 3rem;
}
main > .articles-list > div:last-of-type >div:first-of-type{
display: flex;
justify-content: space-between;
}
main > .articles-list > div:last-of-type >div:last-of-type > div{
display: flex;
}
main > .articles-list > div:last-of-type >div:last-of-type > div > p{
margin-left: 1rem;
}
/* 精品课程css 布局 */
main > .container {
min-width:78rem;
display: grid;
grid-template-columns: repeat(5,14rem);
grid-template-rows: 4rem repeat(3,10rem);
grid-gap: 0.5rem;
box-shadow: 0 0 10px lightslategrey;
border-radius: 0.5rem;
margin-bottom: 2rem;
place-content: space-evenly space-evenly;
place-items: center center;
padding-bottom: 1rem;
}
main > .container > span {
grid-area: span 1 / span 5;
width: 14rem;
display: flex;
justify-content: center;
align-items: center;
}
main > .container > img{
grid-area: 2 / 1 / 4 / 2;
width: 13rem;
height: 20rem;
border-radius: 0.5rem;
box-shadow: 0 0 10px lightslategrey;
}
main > .container > .item {
position: relative;
box-shadow: 0 0 10px lightslategrey;
border-radius: 0.5rem;
}
main > .container > .item > img{
width: 13rem;
height: 9rem;
border-radius: 0.5rem;
}
main > .container > .item > div {
width: 13rem;
background-color: #fff;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
padding: 0.4rem 0.2rem 0.2rem;
font-size: 0.9rem;
border-radius: 0.5rem;
/* z-index: 10; */
position: absolute;
bottom:0;
height: 3rem;
}
main > .container > .item > div:hover{
height: 5rem;
}
main > .container > .item > div > span > span{
background-color: #969896;
color: white;
font-style: none;
margin-left: 0.4rem;
margin-right: 0.4rem;
}
main > .container > .item > div > span:last-child{
font-size: 0.6rem;
color:#D3D3D3;
}
3.代码运行结果图: