zoukankan      html  css  js  c++  java
  • 导航页面样式

    用一下的代码为例:

    <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>
  • 相关阅读:
    给“file”类型的input框赋值的问题
    bootstrap-paginator分页插件的两种使用方式
    开发中使用UEditor编辑器的注意事项
    java图形界面设计
    ArrayList 、LinkList区别以及速度对比
    java中的ArrayList 、List、LinkedList、Collection关系详解
    Josephus问题的不同实现方法与总结
    浅谈JAVA中字符串常量的储存位置
    linux安装vmware出现Gtk-Message: Failed to load module pk-gtk-module canberra-gtk-module的解决方法
    ubuntu安装搜狗输入法的相关问题
  • 原文地址:https://www.cnblogs.com/JQ330-54864/p/5746616.html
Copyright © 2011-2022 走看看