zoukankan      html  css  js  c++  java
  • css实现下拉列表练习,原来javascipt的onmouseover和onmouseout可以用css轻松实现

    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <link href="style/style.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="js.js"></script>
        <style type="text/css">


        </style>
        <script type="text/javascript">


        </script>
    </head>
    <body>
    <h3>标题栏测试</h3>


    <div id="nav">
        <ul>
            <li>我的首页
                <ul>
                    <li><a href="#">我的Png</a></li>
                    <li><a href="#">我的Gif</a></li>
                    <li><a href="#">我的酷站</a></li>
                    <li><a href="#">我的收藏</a></li>
                </ul>
            </li>
            <li>我的首页
                <ul>
                    <li><a href="#">我的Png</a></li>
                    <li><a href="#">我的Gif</a></li>
                    <li><a href="#">我的酷站</a></li>
                    <li><a href="#">我的收藏</a></li>
                </ul>
            </li>
            <li>我的首页
                <ul>
                    <li><a href="#">我的Png</a></li>
                    <li><a href="#">我的Gif</a></li>
                    <li><a href="#">我的酷站</a></li>
                    <li><a href="#">我的收藏</a></li>
                </ul>
            </li>
            <li>我的首页
                <ul>
                    <li><a href="#">我的Png</a></li>
                    <li><a href="#">我的Gif</a></li>
                    <li><a href="#">我的酷站</a></li>
                    <li><a href="#">我的收藏</a></li>
                </ul>
            </li>
        </ul>
    </div>
    </body>

    </html>

    ==============================================

    CSS

    ==============================================

    body {
        background: #fff;
        font-size: 16px;
    }


    h3 {
        text-align: center;
    }


    ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
    }


    #nav > ul > li {
        120px;
        border: 1px solid #eee;
        background: #f1fbec;
        padding: 4px 0;
        text-align: center;
        color: #999;
        cursor: pointer;
        position: relative;
        float: left;
        margin: 10px;
    }


    #nav ul li:hover {
        background: #f1fbec;
        color: #666;
        border: none;
    }


    #nav > ul > li > ul {
        border: 1px solid #eee;
        border-top: none;
        background: #f1fbec;
        position: absolute;
        top: 26px;
        left: 0;
        display: none;
    }


    #nav > ul > li > ul li a {
        color: #666;
        text-decoration: none;
        font-weight: bold;
    }


    #nav > ul > li > ul > li {
        120px;
        padding: 10px 0;
        border: none;
    }


    #nav > ul > li > ul > li:hover {
        background: lightgreen;
        color: black;
        font-weight: bold;
        font-size: 20px;
    }


    #nav ul li:hover > ul {
        display: block;
    }

  • 相关阅读:
    创建网络数据集
    [虚拟机]Virtual Box的使用--共享文件夹
    MapControl图层删除或添加触发监听事件
    Dev控件GridView单元格绑定控件
    Log4net中换行符
    没有为 COM 互操作注册程序集 请使用 regasm.exe /tlb 注册该程序集——解决办法
    加载dll过程中assembly失败
    Spring Boot 自带缓存及结合 Redis 使用
    Spring Boot + Redis 初体验
    在 Windows 中使用 C# 启动其他程序
  • 原文地址:https://www.cnblogs.com/i124q29/p/3842542.html
Copyright © 2011-2022 走看看