模仿淘宝首页的导航栏

原创 2019-04-30 11:56:53 260
摘要:<!DOCTYPE html><html lang="zh_cn"><head>    <meta charset="UTF-8"><!--    <link rel="stylesheet" href="static/css/s

<!DOCTYPE html>
<html lang="zh_cn">
<head>
   <meta charset="UTF-8">
<!--    <link rel="stylesheet" href="static/css/style1.css">-->
   <link rel="stylesheet" href="static/css/font-awesome-4.7.0/css/font-awesome.css">
   <title>Title</title>
   <style>
       /*给所有标签定义*/
       * {
           margin: 0;
           padding: 0;
       }
       /*给a标签定义一个固定样式*/
       a {
           text-decoration-line: none;
           color: #C3C3C3;
           font-size: 13px;
       }
       .clear {
           clear: both;
       }
       /*导航栏设置背景颜色和高度*/
       .header {
           background-color: #F5F5F5;
           height: 40px;
           width: 100%;
       }
       /*导航栏内容框的宽高设置*/
       .header_content {
           width: 1200px;
           line-height: 40px;
           margin: 0 auto;
           background-color: #F5F5F5;
       }
       /*设置左边导航栏的高度,并进行向左浮动*/
       .header_left {
           height: 40px;
           float: left;
       }
       /*设置左边导航栏按钮间的间距*/
       .header_left a {
           margin-right: 3px;
       }
       /*设置右边导航栏的高度,并进行向右浮动*/
       .header_right {
           height: 40px;
           float: right;
       }
       /*设置右边导航栏按钮间的间距*/
       .header_right a {
           margin-left: 3px;
       }
       /*将.header_a类选择器中元素该为行内块元素,并设置文本居中显示*/
       .header_a{
           display: inline-block;
           height: 40px;
           width: 80px;
           text-align: center;
       }
       /*添加光标停留时.header_a类标签的显示效果*/
       .header_a:hover {
           /*line-height: 40px;*/
           background-color: white;
       }
       /*添加光标停留时<a>的显示效果*/
       a:hover {
           color: #FF5000;
       }
   </style>
</head>
<body>

<div class="header">
   <div class="header_content">
       <div class="header_left">
           <a href="" class="header_a">中国大陆 &nbsp <i class="fa fa-angle-down"></i></a>
           <a href="" style="color: #FF5000">亲,请登录</a>
           <a href="">免费注册</a>
           <a href="">手机逛淘宝</a>
       </div>
       <div class="header_right">
           <a href="" class="header_a">我的淘宝<i class="fa fa-angle-down"></i></a>
           <a href="" ><i class="fa fa-shopping-cart"  style="color: #FF5000"></i> &nbsp 购物车</a>
           <a href="" class="header_a"><span class="fa fa-star"></span> &nbsp 收藏夹<i class="fa fa-angle-down"></i></a>
           <a href="" class="header_a">商品分类</a>
           <a href="" class="header_a">卖家中心 &nbsp <i class="fa fa-angle-down"></i></a>
           <a href="" class="header_a">联系客服</a>
       </div>
       <div class="clear"></div>
   </div>
</div>
</body>
</html>

批改老师:查无此人批改时间:2019-05-05 09:29:04
老师总结:完成的不错。常用的css样式,可以写到一个公用文件里,随时可以使用。继续加油。

发布手记

热门词条