2025-03-29

<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>菜单</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        html,
        body{
            height: 100%;
            width: 100%;
        }
        html{
            font-size: 10px;
        }
        .nav{
            width: 100%;
            height: 5rem;
            background-color: antiquewhite;
            display: flex;
            justify-content: center;
        }
        .content{
            width: 120rem;
            display: flex;
        }
        .content .items{
            font-size: 1.2rem;
            list-style: none;   
            height: 100%;
            padding: 0 5rem;
            text-align: center;
            line-height: 5rem;
            cursor: pointer;
            position: relative;
        }
        .content .items:hover{
            background-color: #fff;
            color: #333;
        }
        .children{
            list-style: none;
            background-color: antiquewhite;
            position: absolute;
            left: 0;
            top: 5rem;
            display: none;
            width: 100%;
        }
        .items:hover .children{
            display: block;
        }
        .children li{
            padding: 1rem 2rem;
            position: relative;
            text-align: left;
        }
        .children li:hover{
            background-color: aquamarine;
            color: #333;
        }
    </style>
</head>
<body>
    <div class="nav">
        <ul class="content">
            <li class="items">首页</li>
            <li class="items">文章
                <ul class="children">
                    <li>发表文章</li>
                    <li>我的文章</li>
                    <li>文章管理</li>
                    <li>文章分类</li>
                </ul>
            </li>
            <li class="items">相册
                <ul class="children">
                    <li>我的相册</li>
                    <li>储存相册</li>
                    <li>相册管理</li>
                    <li>相册分类</li>
                </ul>
            </li>
            <li class="items">消息
                <ul class="children">
                    <li>我的消息</li>
                    <li>发送消息</li>
                    <li>删除消息</li>
                    <li>复制消息</li>
                </ul>
            </li>
            <li class="items">设置
                <ul class="children">
                    <li>个人设置</li>
                    <li>系统设置</li>
                    <li>安全设置</li>
                    <li>通知设置</li>
                </ul>
            </li>
        </ul>
    </div>
    <script>
        let _lis=document.grtElementsByClassName("items")
        for(let i=0;i<_lis.length;i++){
            _lis[i].onmouseenter=function(){
                let child=_lis[i].grtElementsByClassName("children")
                if(child.length>0){
                    child[0].style.display="block"
                }
            }
            _lis[i].onmouseleave=function(){
                let child=_lis[i].grtElementsByClassName("children")
                if(child.length>0){
                    child[0].style.display="none"
                }
            }
        }
    </script>
</body>
</html>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 《乘风2025》第二期一公领衔团争夺赛观后感。满分100。造型/选曲/个人/团队配合,来综评。 1.叶童、怒恩·沃...
    娱娱鱼阅读 123评论 0 6
  • 造价员生存实录,看完再入行! 家人们,今天来聊聊造价员。这可不是简单算算钱的活儿,而是建筑行业里的“精打细算师”,...
    c3b8b71a4d96阅读 31评论 0 0
  • 忙碌了一天,终于到了接儿子放学的时间,我接上他后便马不停蹄地往老家赶。老家的饭菜总是透着浓浓的烟火气,一家人围坐在...
    不在畏惧阅读 55评论 0 2
  • 子曰:“已矣乎!吾未见好德如好色者也。” ----孔子《论语·卫灵公》 孔子说:“也罢了吧!我没有看见像追求美色一...
    陆颜阅读 55评论 0 0
  • 投射我儿读书明理,修身做人,每天情绪平和稳定,阳光快乐,越来越会调节自己的情绪和压力。 投射我儿成为更好的自己,多...
    花开生两面阅读 34评论 0 0