css下拉菜单样式标注

原创 2018-11-16 10:38:27 357
摘要:<!DOCTYPE html><html>   <head>      <title>天猫精选-上天猫,就够了</title>      <meta charset="utf-8">      <lin
<!DOCTYPE html>
<html>
  <head>
     <title>天猫精选-上天猫,就够了</title>
     <meta charset="utf-8">
     <link href="static/css/style.css" rel="stylesheet" type="text/css">
             <link rel="shortcut icon"  href="static/images/logo1.png" type="image/x-icon" />
         <link href="static/font-awesome/css/font-awesome.min.css" rel="stylesheet"> 


   *{margin: 0px; padding: 0px;}
   /*清除浏览器默认内外边距*/
   a{text-decoration: none;color: #000;font-size: 13px;}
   /*a标签默认样式重设*/
   ul{list-style: none;}
   /*清除ul默认样式*/
   .clear{clear: both}
   /*清除浮动,如果父容器不设定高度,其高度由子容器高度进行撑开。*/
   /*子容器设定浮动属性图例文档流,则会出现父容器『坍塌』的情况*/
   /*通过空div与clear属性的设定使父容器『被撑开』*/

   .header{width: 100%; background: #f5f5f5;}
   /*导航总体局部容器*/
   .header_content{width: 1200px; margin: 0px auto; line-height: 40px;}
   /*导航内容容器 定宽width: 1200px | 容器水平居中 | height: 40px& line-height: 40px 文字内容纵向居中*/
   .header_left{height: 40px;float: left;}
   .header_left a{margin-right: 5px;}
   /*左子容器a标签之间的横向边距*/
   .header_content a:hover{color: #FF5000;}
   /*悬浮在a标签上字体变橙*/
   .header_right{height: 40px;width: 600px;float: right;}
   .header_a{display: inline-block;height: 40px; width: 90px;text-align: center; position: relative;}
   /*a为行内元素,宽高属性设定不生效。通过display: inline_block设定为行内块元素即可设定宽高*/
   /*带有小箭头的a标签单独设立为一个容器设定样式*/
   .header_a:hover{background: #fff;}
   /*悬浮在a标签上背景变白*/
   .header_a ul{border: 1px solid #f5f5f5;display: none; border-top: none;}
   /*悬浮菜单默认不可见 | 无顶边线*/
   .header_a:hover ul{display: block;position: absolute; width: 100px;}
   /*鼠标悬浮在a.header_a容器上触发其中ul的display: block使其可见*/
   /*绝对定位脱离文档流,以父容器中position: relative为定位参照*/
   .header_a ul li:hover{background-color: #f5f5f5;}
   /*ul弹夹容器中的li子弹容器悬浮效果改变背景*/
   .header_a ul li{color:#6c6c6c; height: 30px; line-height: 30px; text-align: left;padding: 0px 3px;margin:5px 0px;}
   /*li子弹容器中的文本属性样式设定*/
</style>

  </head>
  <body> 
<!-- 头部导航 -->
      <div class="header">
        <div class="header_content">
           <div class="header_left">
              <!--通过&nbsp;控制小间距-->
              <a href="" class="header_a">中国大陆 &nbsp; &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">
              <!--span或i引入图标样式,两者只作为传导载体-->
              <a href="" class="header_a">我的淘宝 <i class="fa fa-angle-down"></i>
                      <!--悬浮表单ul嵌入a标签项中-->
                      <ul>
                          <li>已买到的宝贝</li>
                          <li>我的足迹</li>
                      </ul>
                  </a>
              <a href=""><span class="fa fa-cart-plus"></span>&nbsp; &nbsp;购物车</a>
              <a href=""><span class="fa fa-star"></span>&nbsp; &nbsp;收藏夹 <i class="fa fa-angle-down"></i></a>
              <a href="">商品分类</a>
              <a href="" class="header_a">卖家中心 <i class="fa fa-angle-down"></i></a>
              <a href="" class="header_a">联系客服 <i class="fa fa-angle-down"></i></a>
              <a href="" class="header_a">网站导航 <i class="fa fa-angle-down"></i></a>
           </div>
        </div>
        <div class="clear"></div>
     </div>
  </body>
</html>


批改老师:韦小宝批改时间:2018-11-16 11:04:39
老师总结:嗯!不错!但是代码缺少高亮以及总结!下次记得加上哦!!

发布手记

热门词条