(编辑:jimmy 日期: 2024/10/31 浏览:2)
两种风格:
1:点菜单项,每个子菜单项都可显示
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>30秦甜甜_实训13-2_2_180701802230_18计算机2班</title> </head> <style type="text/css"> * { padding: 0; margin: 0; list-style: none; } .menu-list { width: 300px; margin: 60px auto; border: 2px solid #bbffff; } .menu-head { background-color: #aaaaff; text-align: center; height: 100px; line-height: 100px; } .menu-body>li { height: 60px; line-height: 60px; text-align: center; } </style> <script src="/UploadFiles/2021-04-02/jquery.js">运行结果图:
2:点菜单项,仅当前子菜单项可显示,其余子菜单隐藏
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>30秦甜甜_实训13-2_3_180701802230_18计算机2班</title> </head> <style type="text/css"> * { padding: 0; margin: 0; list-style: none; } .menu-list { width: 300px; margin: 60px auto; border: 2px solid #bbffff; } .menu-head { background-color: #aaaaff; text-align: center; height: 100px; line-height: 100px; } .menu-body>li { height: 60px; line-height: 60px; text-align: center; } </style> <script src="/UploadFiles/2021-04-02/jquery.js">运行结果图:
总结