• 导航页面样式


    用一下的代码为例:

    <body>
    
    <ul class="nav">
        <li><a class="on" href="#">首  页</a></li>
        <li><a href="#">新闻快讯</a></li>
        <li><a href="#">产品展示</a></li>
        <li><a href="#">售后服务</a></li>
        <li><a href="#">联系我们</a></li>
      </ul>
    
    </body>

    1.水平菜单的制作:

    *{margin:0; padding:0; font-size:14px;}
    ul{ list-style:none;}
    a{color:#333;text-decoration:none}
    .nav li{ float:left;}
    .nav li a{ display:block; text-indent:20px; height:30px; line-height:30px; width:100px; background-color:#efefef; margin-bottom:1px;}
    .nav li a:hover{ background-color:#F60; color:#fff}

    2.圆角菜单的制作:

      *{margin:0; padding:0; font-size:14px;}
            a{color:#333;text-decoration:none}
            .nav{list-style:none; height:30px; border-bottom:10px solid #F60; margin-top:20px; padding-left:50px;}
            .nav li{float:left}
            .nav li a{display:block; height:30px;text-align:center; line-height:30px; width:120px; border-radius:12px 12px 0 0; margin-left:1px;background-color:#ddd;}
            .nav li a.on, .nav li a:hover{background-color:#F60; color:#fff;}

     

    3.高度改变的伸缩导航:

    *{margin:0; padding:0; font-size:14px;}
    a{color:#333;text-decoration:none}
    ul{list-style:none; height:50px; border-bottom:5px solid #F60; padding-left:30px;}
    ul li{float:left; margin-top:20px;}
    a{display:block;height:30px;text-align:center; line-height:30px; width:120px; background-color:#ccc;}
    a.on, a:hover{ color:#fff;background-color:#F60;height:40px; line-height:40px;margin-top:-10px;}

     

    4.水平伸缩导航:

    * { margin: 0; padding: 0; font-size: 14px; }
    a { color: #333; text-decoration: none }
    ul { list-style: none; height: 30px; border-bottom: 5px solid #F60; margin-top: 20px; padding-left: 50px; }
    ul li { float: left }
    ul li a { display: block; height: 30px; text-align: center; line-height: 30px; width:120px; background: #efefef; margin-left: 1px; }
    a.on, a:hover { background: #F60; color: #fff; }
    <script>
    window.onload=function(){
        var aA=document.getElementsByTagName('a');
        for(var i=0; i<aA.length; i++){
            aA[i].onmouseover=function(){
                var This=this;
                clearInterval (This.time);
                This.time= setInterval (function(){
                        This.style.width=This.offsetWidth+8+"px";
                        if(This.offsetWidth >=160)
                        clearInterval(This.time);
                    },30)
            }
            aA[i].onmouseout=function(){
                    clearInterval(this.time);
                    var This=this;
                    this.time=setInterval(function(){
                        This.style.width=This.offsetWidth-8+"px";
                        if(This.offsetWidth<=120){
                            This.style.width='120px';
                            clearInterval(This.time);
                        }
                    },30)
            }
        }
    }
    </script>
  • 相关阅读:
    C/C++中extern关键字详解
    C/C++中static关键字详解
    MFC创建工程图解
    C++中L和_T()之区别
    C/C++中const关键字详解
    winfrom中,父窗体中只允许显示一个子窗体的代码怎么写?
    sql 批量插入
    visual studio .net ide : checking into source control now says checkIn Now (recursive)
    1.4 Turbo C V2.0的基本操作
    关于vs2003不能调试的解决方法
  • 原文地址:https://www.cnblogs.com/JQ330-54864/p/5746616.html
Copyright © 2020-2023  润新知