中易网

如何使用css写出一个下拉菜单

答案:2  悬赏:70  
解决时间 2021-02-14 06:22
如何使用css写出一个下拉菜单
最佳答案
纯CSS的下拉菜单,我理解的意思就是标签套标签,然后再给标签设置样式。在被套的标签设置平时状态为隐藏,再等鼠标移动到上一个标签时,将被套的标签显示(样式:overflow:hidden; )。大致意思就是如此。
全部回答
<html> <head> <metahttp-equiv="content-type"content="text/html;charset=gb2312"/> <title>无标题文档</title> <styletype="text/css"> body{ background-color:white; font-size:12px; font-family:arial,helvetica,sans-serif; margin:0px; padding:0px; color:white; } ul,li{ margin:0px; padding:0px; } li{ display:inline; list-style:none; list-style-position:outside; text-align:center; font-weight:bold; float:left; } a:link{ color:#336601; text-decoration:none; float:left; width:100px; padding:3px5px0px5px; } a:visited{ color:#336601; text-decoration:none; float:left; padding:3px5px0px5px; width:100px; } a:hover{ color:white; float:left; padding:3px3px0px20px; width:88px; text-decoration:none; background-color:#539d26; } a:active{ color:white; float:left; padding:3px3px0px20px; width:88px; text-decoration:none; background-color:#bd06b4; } #nav{ width:600px; height:30px; border-bottom:0px; padding:0px5px; position:absolute; z-index:1; left:198px; top:25px; } .list{ line-height:20px; text-align:left; padding:4px; font-weight:normal; } .menu1{ width:120px; height:auto; margin:6px4px0px0px; border:1pxsolid#9cdd75; background-color:#f1fbec; color:#336601; padding:6px0px0px0px; cursor:hand; overflow-y:hidden; filter:alpha(opacity=70); -moz-opacity:0.7; } .menu2{ width:120px; height:18px; margin:6px4px0px0px; background-color:#f5f5f5; color:#999900; border:1pxsolid#eee8dd; padding:6px0px0px0px; overflow-y:hidden; cursor:hand; } </style> </head> <body> <divid="nav"> <ul> <liclass="menu2"onmouseover="this.classname='menu1'"onmouseout="this.classname='menu2'">我的首页 <divclass="list"> <ahref="#">我爱css</a><br/> <ahref="#">我的首页</a><br/> <ahref="#">我的日志</a><br/> <ahref="#">我的日志</a><br/> <ahref="#">我的相册</a><br/> <ahref="#">我的收藏</a><br/> </div> </li> <liclass="menu2"onmouseover="this.classname='menu1'"onmouseout="this.classname='menu2'">社区圈子 <divclass="list"> <ahref="#">我爱css</a><br/> <ahref="#">我的首页</a><br/> <ahref="#">我的日志</a><br/> <ahref="#">我的相册</a><br/> <ahref="#">我的收藏</a><br/> </div> </li> <liclass="menu2"onmouseover="this.classname='menu1'"onmouseout="this.classname='menu2'">我的短信 <divclass="list"> <ahref="#">我爱css</a><br/> <ahref="#">我的相册</a><br/> <ahref="#">我的收藏</a><br/> </div> </li> <liclass="menu2"onmouseover="this.classname='menu1'"onmouseout="this.classname='menu2'">账户管理 <divclass="list"> <ahref="#">我爱css</a><br/> <ahref="#">我的首页</a><br/> <ahref="#">我的日志</a><br/> <ahref="#">我的相册</a><br/> <ahref="#">我的收藏</a><br/> <ahref="#">我的日志</a><br/> <ahref="#">我的相册</a><br/> <ahref="#">我的收藏</a><br/> </div> </li> </ul> </div> </body> </html> 这个当时可是花了我大半天的时间才做出来的啊。强烈要求加点分啊。 qq:471108626
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
桌面文件名有蓝影
一品香早餐我想知道这个在什么地方
口袋妖怪永恒之沫的作弊码?和怎么用,我的模
i5 4440换i7 4790k要刷主板bios吗?我的主板
唐朝的将军和元帅有什么区别
【急急!!!】意思相近但有区别的成语
巢湖在安徽哪里
给小孩带的银手镯发黑,是怎么回事
《重生之名流巨星》是BI还是BG
怎么用万用表测小电容的容值?
用焦距为15cm的凸透镜观察邮票上较小的图案,
CPA这个证拿到手以后的就业前景怎么样呢?
一根圆柱形木材的长是一米底面直径是四分米十
按目前的通货膨胀速度 我现在25岁 到退休30年
世界上最远的距离不是生与死,而是我明明站在
推荐资讯
动物小说集太阳光点的主要内容简介是什么
我看到有些人笑起来好好看,怎样,笑好看,而
ProDAD Mercalli安装时没有勾选ED怎么回事!
求比例尺的题的最后结果一定要化成前项或后项
brochure的中文意思
这三条7-8厘米鱼吃什么啊那条有斑点的鱼苗不
7天连锁酒店火车站店地址有知道的么?有点事
过上湖岭望招贤江南北山作者的情感
起诉离婚法院判同意离婚但没有判离算离婚吗
我要做一个品牌,美肤宝好还是本草堂好?
3250综合测试机 谁知道怎么系统归零
舜厚添(上海)股权投资基金管理有限公司在哪里
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?