css实现鼠标悬浮弹出子菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现鼠标悬浮弹出子菜单效果代码

代码标签: css 鼠标 悬浮 弹出 子菜单

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>导航栏示例</title>
    <style>
        /* 导航栏样式 */
        .nav {
            list-style: none;
            padding: 0;
            margin: 0;
            background-color: #333;
            height: 50px;
            
        }

        .nav-item {
            float: left;
            position: relative;
        }

        .nav-item a {
            display: block;
            color: white;
            text-align: center;
            padding: 14px 16px;
            text-decoration: none;
        }

        .nav-item a:hover {
            background-color: #111;
        }

        /* 子菜单样式 */
        .nav-child {
            display: none;
           
            position: absolute;
            background-color: #333;
            min-width: 110px;
           
            z-index: 1111;
        }

        .nav-child a {
            color: white;
            padding: 12px 16px;
            text-decoration: none;
            display: block;
            text-align: left;
        }

        .nav-child a:hover {
            background-color: #575757;
        }

        /* 鼠标悬停显示子菜单 */
        .nav-item:hover .nav-child {
            display: block;
        }
        ul{
            list-style: none;
            margin: 0;
            padding: 0;
        }
    </st.........完整代码请登录后点击上方下载按钮下载查看

网友评论0