1220号作业
效果图展示
终于是完成了一次作业,之前的作业后面会慢慢补上
<!DOCTYPE html>
<html lang="en">
<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">
<link rel="stylesheet" href="D:\phpstudy_pro\WWW\static\font\iconfont.css">
<!-- <link rel="stylesheet" href="D:\phpstudy_pro\WWW\chapter1\1220zuoye.css"> -->
<style media="screen">
/* 初始化 */
*{
margin: 0;
padding: 0;
font-size: 14px;
/* 添加一个轮廓线 */
/* outline: 1px dashed red; */
}
/* A 标签需要单独设置字体和颜色 */
a {
color: #555;
font-size: 13px;
/* 下划线去掉 */
text-decoration: none;
}
/* 容器,大盒子,ID能不用就不用,尽可能用class */
.index-header{
width: 1200px;
min-height: 300px;
margin: 30px auto;
}
/* 父级类 后买要是空格,则是选择所有下级类 */
.index-header > .logo-search-quickly{
height: 70px;
/* 绝对定位,相对于他的父级元素定位, */
/* 相对定位,相对于元素其本身 */
/* 固定,则是相对于整个html文档。 */
/* 转为定位元素 */
position: relative;
}
/* 统一样式 */
.index-header > .logo-search-quickly * {
/* 默认和父元素一致 */
height: inherit;
/* 设置行高,就可以使得行内元素垂直居中 */
line-height: 70px;
}
/* logo */
.index-header > .logo-search-quickly > .logo {
width: 170px;
position: absolute;
/* 默认值,可省略 */
top: 0;
left: 0;
}
.index-header > .logo-search-quickly > .search {
width: 330px;
position: absolute;
/* 默认值,可省略 */
right: 350px;
}
.index-header > .logo-search-quickly > .quickly {
width: 300px;
position: absolute;
/* 默认值,可省略 */
right: 0;
}
.index-header > .logo-search-quickly > .logo img {
/* 自适应,响应式图片 */
height: 100%;
/* 这里添加图片有,有个bug,图片底部有白边,需要设置为块元素 */
display: block;
}
.index-header > .logo-search-quickly > .search > input[type="search"] {
width: 330px;
height: 36px;
border-radius: 10px;
padding: 10px;
}
/* 放大镜图标,加号,选择相邻元素 */
.index-header > .logo-search-quickly > .search > input[type="search"]+label {
/* 放大镜是字体图标 */
font-size: 23px;
margin-left: -30px;
position: relative;
top: 5px;
}
.index-header > .logo-search-quickly > .quickly > a {
font-size: 33px;
margin-left: 6px;
}
.index-header > .logo-search-quickly > .quickly > a:hover {
color: red;
/* 设置鼠标样式 */
cursor: pointer;
}
.index-header > .logo-search-quickly > .search > input[type="search"]:hover{
box-shadow: 6px 6px 5px #888888
}
/* 中间导航区 */
.index-header > .main-nav{
height: 44px;
}
.index-header > .main-nav > .nav-deatail{
width: 300px;
height: inherit;
/* 转为定位元素,父级 */
position: relative;
float: left;
}
.index-header > .main-nav > .nav-deatail > .pic > .iconfont{
font-size: 40px;
color: red;
position: absolute;
}
.index-header > .main-nav > .nav-deatail > .pic > .tag{
width: 40px;
position: absolute;
left: 45px;
border-right: 1px solid #cccccc;
}
.index-header > .main-nav > .nav-deatail > .links{
width: 120px;
position: absolute;
left: 95px;
}
.index-header > .main-nav > .nav-deatail > .links a:hover{
color: red;
}
.index-header > .banner {
height: 320px;
position: relative;
}
.index-header > .banner > .slider {
width: 900px;
position: absolute;
}
.index-header > .banner > .ads {
width: 295px;
position: absolute;
right: 0;
}
.index-header > .banner img {
height: 100%;
display: block;
}
</style>
<title>12月20日作业</title>
</head>
<div class="index-header">
<div class="logo-search-quickly">
<div class="logo">
<a href=""><img src="D:\phpstudy_pro\WWW\static\images\logo.png" alt=""></a>
</div>
<div class="search">
<input type="search" name="search" id="search">
<label for="search" class="iconfont icon-jinduchaxun"></label>
</div>
<div class="quickly">
<a href="" class="iconfont icon-huiyuan1"></a>
<a href="" class="iconfont icon-danmu1"></a>
<a href="" class="iconfont icon-fabu"></a>
<a href="" class="iconfont icon-fangda"></a>
<a href="" class="iconfont icon-huiyuan2"></a>
<a href="" class="iconfont icon-dianzan"></a>
</div>
</div>
<div class="main-nav">
<div class="nav-deatail">
<div class="pic">
<span class="iconfont icon-gongdan"></span>
<div class="tag">
<span>资讯</span>
<span>学习</span>
</div>
</div>
<div class="links">
<a href="">器材</a>
<a href="">大师</a>
<a href="">学院</a>
<a href="">实战</a>
<a href="">大赛</a>
<a href="">裤子</a>
<a href="">影视</a>
<a href="">其它</a>
</div>
</div>
<div class="nav-deatail">
<div class="pic">
<span class="iconfont icon-renwujincheng"></span>
<div class="tag">
<span>爱好</span>
<span>姐妹</span>
</div>
</div>
<div class="links">
<a href="">油品</a>
<a href="">飞机</a>
<a href="">图片</a>
<a href="">喝水</a>
<a href="">坦克</a>
<a href="">气球</a>
<a href="">毛虾</a>
<a href="">大侠</a>
</div>
</div>
<div class="nav-deatail">
<div class="pic">
<span class="iconfont icon-gongdan"></span>
<div class="tag">
<span>软件</span>
<span>技能</span>
</div>
</div>
<div class="links">
<a href="">学习</a>
<a href="">爱国</a>
<a href="">敬业</a>
<a href="">友善</a>
<a href="">明主</a>
<a href="">富强</a>
<a href="">和平</a>
<a href="">正义</a>
</div>
</div>
<div class="nav-deatail">
<div class="pic">
<span class="iconfont icon-gongdan"></span>
<div class="tag">
<span>编程</span>
<span>美女</span>
</div>
</div>
<div class="links">
<a href="">吃饭</a>
<a href="">睡觉</a>
<a href="">合肥</a>
<a href="">北京</a>
<a href="">杭海</a>
<a href="">云南</a>
<a href="">西安</a>
<a href="">天津</a>
</div>
</div>
</div>
<div class="banner">
<div class="slider">
<a href=""><img src="D:\phpstudy_pro\WWW\static\images\2.jpg" alt=""></a>
</div>
<div class="ads">
<a href=""><img src="D:\phpstudy_pro\WWW\static\images\banner-right.jpg" alt=""></a>
</div>
</div>
</div>
<body>
</body>
</html>
*完成作业的时候,遇到一个问题,就是广告图片在加上css之后,就一直会超出index-header的范围,且加上
right:0;
的时候,广告图片一直居右,最后费了好长时间,各种修改,各种尝试,在调试的时候,发现banner类的css一直没有生效,随即检查css代码是,发现上面多了一个
}
修改之后,就完全正常了。第一次学习的时候,还是很有必要跟着老师的思路,一步步完成,多写几次,慢慢就有感觉了。