摘要://html部分<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/x
//html部分
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>淘宝导航</title>
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome-4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="header">
<div class="header_content">
<div class="header_left">
<a href="" class="header_a">中国大陆 <li class="fa fa-angle-down"> </li></a>
<a href="" style="color:#C03">亲,请登录</a>
<a href="">免费注册</a>
<a href="">手机逛淘宝</a>
</div>
<div class="header_right">
<a href="" class="header_a">我的淘宝<li class="fa fa-angle-down"></li>
<ul>
<li>已买到的宝贝</li>
<li>我的足迹</li>
</ul>
</a>
<a href=""><li class="fa fa-cart-plus">购物车<li class="fa fa-angle-down"></li></a>
<a href="" class="header_a"> <span class="fa fa-star"></span>收藏夹</a>
<a href="" class="header_a">商品分类</a>
<a href="" class="header_a">卖家中心<li class="fa fa-angle-down"></li></a>
<a href="" class="header_a">联系客服<li class="fa fa-angle-down"></li></a>
<a href="" class="header_a">网站导航<li class="fa fa-angle-down"></li>
<ul>
<li>已买到的宝贝</li>
<li>我的足迹</li>
<li>我的足迹</li>
</ul>
</a>
</div>
</div>
</div>
<div class="clear">
</body>
</html>
//css部分
*{
margin: 0px;
padding: 0px;
}
a{
color: #333;
text-decoration: none;
font-size: 10px;
}
li{list-style:none}
.clear{clear:both;}
.header{
weight: 100%;
height:40px;
background: #F5F5F5;
}
.header_a{
display: inline-block;
width: 80px;
height: 40px;
text-align: center;
position: relative;
}
.header_a:hover{
background-color: #FFF;
}
.header_content{
width: 1200px;
margin: 0px auto;
line-height: 40px;
}
.header_left{
float: left;
height: 40px;
width: 300px;
}
.header_left a{
margin-right: 5px;
}
.header_content a:hover{color:#ff5000;}
.header_right{
float: right;
height: 40px;
width: 600px;
}
.header_right a{
margin-right:5px;}
.header_a ul{
display: none;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #CCC;
border-right-color: #CCC;
border-bottom-color: #CCC;
border-left-color: #CCC;
}
.header_a:hover ul{
display: block;
position: absolute;
}
.header_a ul li{
color: #6c6c6c;
height: 30px;
line-height: 30px;
text-align: left;
}
.header_a ul li:hover{
background-color: #CCC;
}
css总结
常用无序列表
<ul>
<li></li>
</ul>
border-style 值: 常用
none: 默认无边框
dashed: 定义一个虚线框
solid: 定义实线边界
CSS Display(显示) 与 Visibility(可见性)
隐藏一个元素可以通过把display属性设置为"none",或把visibility属性设置为"hidden"。但是请注意,这两种方法会产生不同的结果。
visibility:hidden可以隐藏某个元素,但隐藏的元素仍需占用与未隐藏之前一样的空间。也就是说,该元素虽然被隐藏了,但仍然会影响布局。
display:none可以隐藏某个元素,且隐藏的元素不会占用任何空间。也就是说,该元素不但被隐藏了,而且该元素原本占用的空间也会从页面布局中消失。
display:block 块状元素的方式显示
Positioning(定位)
Static 定位
HTML元素的默认值,即没有定位,元素出现在正常的流中。
静态定位的元素不会受到top, bottom, left, right影响。
Fixed 定位
元素的位置相对于浏览器窗口是固定位置。
即使窗口是滚动的它也不会移动:
Relative 定位
相对定位元素的定位是相对其正常位置。
Absolute 定位
绝对定位的元素的位置相对于最近的已定位父元素,如果元素没有已定位的父元素,那么它的位置相对于<html>:
批改老师:天蓬老师批改时间:2018-12-20 20:41:11
老师总结:下拉菜单 , 在实际的开过程 , 纯css实现不多见, 更多是配合javascript,完成更多的更复杂的业务逻辑, 不过,css菜单也是一个不错的练手项目