网站根目录是指存放网站的第一层文件夹,内部包含当前网站的所有素材,包含 HTML、CSS、图片、JavaScript等等。
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-uXIiqznv-1691944062625)(assets/1680336645218.png)]
<link rel="stylesheet" href="./css/base.css">
<link rel="stylesheet" href="./css/index.css">
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ia7HEPSa-1691944062627)(assets/1680336711608.png)]
.wrapper {
margin: 0 auto;
width: 1200px;
}
body {
background-color: #f3f5f7;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tOq5bzoj-1691944062627)(assets/1680337054328.png)]
<div class="header">
<div class="wrapper">
<div class="logo">logodiv>
<div class="nav">导航div>
<div class="search">searchdiv>
<div class="user">用户div>
div>
div>
/* 头部区域 */
.header {
height: 100px;
background-color: #fff;
}
.header .wrapper {
padding-top: 29px;
display: flex;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-z1SypkCu-1691944062628)(assets/1680337229070.png)]
logo 功能:
实现方法:
<div class="logo">
<h1><a href="#">学成在线a>h1>
div>
/* logo */
.logo a {
display: block;
width: 195px;
height: 41px;
background-image: url(../images/logo.png);
font-size: 0;
}
实现方法:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3xe74uCB-1691944062628)(assets/1680337390943.png)]
<ul>
<li><a href="#" class="active">首页a>li>
<li><a href="#">课程a>li>
<li><a href="#">职业规划a>li>
ul>
/* 导航 */
.nav {
margin-left: 102px;
}
.nav ul {
display: flex;
}
.nav li {
margin-right: 24px;
}
.nav li a {
display: block;
padding: 6px 8px;
line-height: 27px;
font-size: 19px;
}
/* actvie 类选择器,表示默认选中的a */
.nav li .active,
.nav li a:hover {
border-bottom: 2px solid #00a4ff;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-XEFVCcAt-1691944062629)(assets/1680337525496.png)]
<div class="search">div>
.search {
display: flex;
margin-left: 64px;
padding-left: 19px;
padding-right: 12px;
width: 412px;
height: 40px;
background-color: #f3f5f7;
border-radius: 20px;
}
<div class="search">
<input type="text" placeholder="请输入关键词">
<a href="#">a>
div>
.search input {
flex: 1;
border: 0;
background-color: transparent;
/* 去掉表单控件的焦点框 */
outline: none;
}
/* ::placeholder 选中就是 placeholder 属性文字样式*/
.search input::placeholder {
font-size: 14px;
color: #999;
}
/* 父级是flex布局,子级变弹性盒子:加宽高生效 */
.search a {
align-self: center;
width: 16px;
height: 16px;
background-image: url(../images/search.png);
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JCnwxMKR-1691944062630)(assets/1680337703358.png)]
<div class="user">
<a href="#">
<img src="./uploads/user.png" alt="">
<span>播仔学前端span>
a>
div>
/* 用户 */
.user {
margin-left: 32px;
margin-top: 4px;
}
.user img {
margin-right: 7px;
/* vertical-align 行内块和行内垂直方向对齐方式 */
vertical-align: middle;
}
.user span {
font-size: 16px;
color: #666;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-HPfFddtG-1691944062630)(assets/1680337778559.png)]
<div class="banner">
<div class="wrapper">
<div class="left">leftdiv>
<div class="right">rightdiv>
div>
div>
/* banner 区域 */
.banner {
height: 420px;
background-color: #0092cb;
}
.banner .wrapper {
display: flex;
justify-content: space-between;
height: 420px;
background-image: url(../uploads/banner.png);
}
<div class="left">
<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="#">UI设计a>li>
<li><a href="#">产品a>li>
ul>
div>
/* 侧导航 */
.banner .left {
padding: 3px 20px;
width: 191px;
height: 420px;
background-color: rgba(0,0,0,0.42);
}
.banner .left a {
/* 块级:宽度是父级的100% */
display: block;
height: 46px;
background: url(../images/right.png) no-repeat right center;
line-height: 46px;
font-size: 16px;
color: #fff;
}
.banner .left a:hover {
background-image: url(../images/right-hover.png);
color: #00a4ff;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-1EmP2FAs-1691944062631)(assets/1680338145736.png)]
<div class="right">
<h3>我的课程表h3>
<div class="content">1div>
div>
/* 课程表 */
.banner .right {
margin-top: 60px;
width: 218px;
height: 305px;
background-color: #209dd5;
border-radius: 10px;
}
.banner .right h3 {
margin-left: 14px;
height: 48px;
line-height: 48px;
font-size: 15px;
color: #fff;
font-weight: 400;
}
.banner .right .content {
padding: 14px;
height: 257px;
background-color: #fff;
border-radius: 10px;
}
<dl>
<dt>数据可视化课程dt>
<dd><span>正在学习span>-<strong>echarts使用步骤strong>dd>
dl>
<dl>
<dt>Vue3医疗项目课程 dt>
<dd><span>正在学习span>-<strong>认识组合式APIstrong>dd>
dl>
<dl>
<dt>React核心技术课程dt>
<dd><span>正在学习span>-<strong>rudex配合TS使用strong>dd>
dl>
.banner .right dl {
margin-bottom: 12px;
border-bottom: 1px solid #e0e0e0;
}
.banner .right dt {
margin-bottom: 8px;
font-size: 14px;
line-height: 20px;
font-weight: 700;
}
.banner .right dd {
margin-bottom: 8px;
font-size: 12px;
line-height: 16px;
}
.banner .right dd span {
color: #00a4ff;
}
.banner .right dd strong {
color: #7d7d7d;
font-weight: 400;
}
<a href="#">全部课程a>
.banner .right a {
display: block;
height: 32px;
background-color: #00a4ff;
text-align: center;
line-height: 32px;
font-size: 14px;
color: #fff;
border-radius: 15px;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CZZDeYtZ-1691944062631)(assets/1680338252106.png)]
<div class="recommend wrapper">
<h3>精品推荐h3>
<ul>
<li><a href="#">HTMLa>li>
ul>
<a href="#" class="modify">修改兴趣a>
/* 精品推荐 */
.recommend {
display: flex;
margin-top: 11px;
padding: 0 20px;
height: 60px;
background-color: #fff;
box-shadow: 0px 1px 2px 0px rgba(211, 211, 211, 0.5);
line-height: 60px;
}
<ul>
<li><a href="#">HTMLa>li>
<li><a href="#">CSSa>li>
<li><a href="#">JavaScripta>li>
<li><a href="#">Node.jsa>li>
<li><a href="#">Ajaxa>li>
<li><a href="#">Vue2.0a>li>
<li><a href="#">Vue3.0a>li>
<li><a href="#">TypeScripta>li>
<li><a href="#">Reacta>li>
ul>
.recommend h3 {
font-size: 18px;
color: #00a4ff;
font-weight: 400;
}
.recommend ul {
/* 除去标题和修改兴趣的尺寸,父级剩余尺寸都给ul,实现把修改兴趣挤到最右侧 */
flex: 1;
display: flex;
}
.recommend ul li a {
padding: 0 24px;
border-right: 1px solid #e0e0e0;
font-size: 18px;
}
.recommend ul li:last-child a {
border-right: 0;
}
.recommend .modify {
font-size: 16px;
color: #00a4ff;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-EWmEHcbE-1691944062632)(assets/1680338517515.png)]
<div class="course wrapper">
<div class="hd">
<h3>精品推荐h3>
<a href="#" class="more">查看全部a>
div>
<div class="bd">1div>
div>
/* 推荐课程 */
.course {
margin-top: 15px;
}
/* 标题 - 公共类,与其他区域共用 */
.hd {
display: flex;
justify-content: space-between;
height: 60px;
line-height: 60px;
}
.hd h3 {
font-size: 21px;
font-weight: 400;
}
.hd .more {
padding-right: 20px;
background: url(../images/more.png) no-repeat right center;
font-size: 14px;
color: #999;
}
<ul>
<li>1li>
<li>2li>
<li>3li>
<li>4li>
<li>5li>
<li>6li>
<li>7li>
<li>8li>
ul>
/* 课程内容 - 公共类 */
.bd ul {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.bd li {
margin-bottom: 14px;
width: 228px;
height: 271px;
background-color: pink;
}
<ul>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course01.png" alt="">div>
<div class="text">
<h4>JavaScript数据看板项目实战h4>
<p><span>高级span> · <i>1125i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course02.png" alt="">div>
<div class="text">
<h4>Vue.js实战——面经全端项目h4>
<p><span>高级span> · <i>2726i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course03.png" alt="">div>
<div class="text">
<h4>玩转Vue全家桶,iHRM人力资源项目h4>
<p><span>高级span> · <i>9456i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course04.png" alt="">div>
<div class="text">
<h4>Vue.js实战医疗项目——优医问诊h4>
<p><span>高级span> · <i>7192i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course05.png" alt="">div>
<div class="text">
<h4>小程序实战:小兔鲜电商小程序项目h4>
<p><span>高级span> · <i>2703i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course06.png" alt="">div>
<div class="text">
<h4>前端框架Flutter开发实战h4>
<p><span>高级span> · <i>2841i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course07.png" alt="">div>
<div class="text">
<h4>熟练使用React.js——极客园H5项目h4>
<p><span>高级span> · <i>95682i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course08.png" alt="">div>
<div class="text">
<h4>熟练使用React.js——极客园PC端项目h4>
<p><span>高级span> · <i>904i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course09.png" alt="">div>
<div class="text">
<h4>前端实用技术,Fetch API 实战h4>
<p><span>高级span> · <i>1516i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/course10.png" alt="">div>
<div class="text">
<h4>前端高级Node.js零基础入门教程h4>
<p><span>高级span> · <i>2766i>人在学习p>
div>
a>
li>
ul>
.bd li .pic {
height: 156px;
}
.bd li .text {
padding: 20px;
height: 115px;
background-color: #fff;
}
.bd li .text h4 {
margin-bottom: 13px;
height: 40px;
font-size: 14px;
line-height: 20px;
font-weight: 400;
}
.bd li .text p {
font-size: 14px;
line-height: 20px;
color: #999;
}
.bd li .text p span {
color: #fa6400;
}
.bd li .text p i {
font-style: normal;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-fUaMPcnm-1691944062633)(assets/1680339112336.png)]
<div class="wrapper">
<div class="hd">
<h3>前端开发工程师h3>
<ul>
<li><a href="#" class="active">热门a>li>
<li><a href="#">初级a>li>
<li><a href="#">中级a>li>
<li><a href="#">高级a>li>
ul>
<a href="#" class="more">查看全部a>
div>
<div class="bd">
<div class="left">
<img src="./uploads/web_left.png" alt="">
div>
<div class="right">
<div class="top"><img src="./uploads/web_top.png" alt="">div>
<div class="bottom">
<ul>
<li>
<a href="#">
<div class="pic"><img src="./uploads/web01.png" alt="">div>
<div class="text">
<h4>JS高级javaScript进阶面向对象ES6h4>
<p><span>高级span> · <i>101937i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/web02.png" alt="">div>
<div class="text">
<h4>零基础玩转微信小程序h4>
<p><span>高级span> · <i>133781i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/web03.png" alt="">div>
<div class="text">
<h4>JavaScript基础——语法解析+项目实战h4>
<p><span>高级span> · <i>8927i>人在学习p>
div>
a>
li>
<li>
<a href="#">
<div class="pic"><img src="./uploads/web04.png" alt="">div>
<div class="text">
<h4>前端框架Vue2+Vue3全套视频h4>
<p><span>高级span> · <i>26022i>人在学习p>
div>
a>
li>
ul>
div>
div>
div>
div>
/* 前端 */
.hd ul {
display: flex;
}
.hd li {
margin-right: 60px;
font-size: 16px;
}
.hd li .active {
color: #00a4ff;
}
.bd {
display: flex;
justify-content: space-between;
}
.bd .left {
width: 228px;
/* background-color: pink; */
}
.bd .right {
width: 957px;
/* background-color: pink; */
}
.bd .right .top {
margin-bottom: 15px;
height: 100px;
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lg1rvMmI-1691944062633)(assets/1680339154682.png)]
<div class="footer">
<div class="wrapper">
<div class="left">leftdiv>
<div class="right">rightdiv>
div>
div>
/* 版权 */
.footer {
margin-top: 60px;
padding-top: 60px;
height: 273px;
background-color: #fff;
}
.footer .wrapper {
display: flex;
justify-content: space-between;
}
.footer .left {
width: 440px;
background-color: pink;
}
<div class="left">
<a href="#"><img src="./images/logo.png" alt="">a>
<p>学成在线致力于普及中国最好的教育它与中国一流大学和机构合作提供在线课程。
© 2017年XTCG Inc.保留所有权利。-沪ICP备15025210号p>
<a href="#" class="download">下载APPa>
div>
<div class="right">
<dl>
<dt>关于学成网dt>
<dd><a href="#">关于a>dd>
<dd><a href="#">管理团队a>dd>
<dd><a href="#">工作机会a>dd>
<dd><a href="#">客户服务a>dd>
<dd><a href="#">帮助a>dd>
dl>
<dl>
<dt>新手指南dt>
<dd><a href="#">如何注册a>dd>
<dd><a href="#">如何选课a>dd>
<dd><a href="#">如何拿到毕业证a>dd>
<dd><a href="#">学分是什么a>dd>
<dd><a href="#">考试未通过怎么办a>dd>
dl>
<dl>
<dt>合作伙伴dt>
<dd><a href="#">合作机构a>dd>
<dd><a href="#">合作导师a>dd>
dl>
div>
.footer .left p {
margin-top: 24px;
margin-bottom: 14px;
font-size: 12px;
line-height: 17px;
color: #666;
}
.footer .left .download {
display: block;
width: 120px;
height: 36px;
border: 1px solid #00a4ff;
text-align: center;
line-height: 34px;
font-size: 16px;
color: #00a4ff;
}
.footer .right {
display: flex;
}
.footer .right dl {
margin-left: 130px;
}
.footer .right dt {
margin-bottom: 12px;
font-size: 16px;
line-height: 23px;
}
.footer .right a {
font-size: 14px;
color: #666;
line-height: 24px;
}