答案:一个DIV+CSS菜单,兼容Firefox,分享给大家,大家一齐学习 运行代码框<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>Div+CSS+JS树型菜单,可刷新</title><meta name="description" content="http://www.livepo.com"><style type="text/css"><!--*{margin:0;padding:0;border:0;}body {font-family: arial, 宋体, serif;font-size:12px;}#nav {width:180px; line-height: 24px; list-style-type: none;text-align:left; /*定义整个ul菜单的行高和背景色*/}/*==================一级目录===================*/#nav a {width: 160px; display: block;padding-left:20px;/*Width(一定要),否则下面的Li会变形*/}#nav li {background:#CCC; /*一级目录的背景色*/border-bottom:#FFF 1px solid; /*下面的一条白边*/float:left;/*float:left,本不应该设置,但由于在Firefox不能正常显示继承Nav的width,限制宽度,li自动向下延伸*/}#nav li a:hover{background:#CC0000;/*一级目录onMouseOver显示的背景色*/}#nav a:link {color:#666; text-decoration:none;}#nav a:visited {color:#666;text-decoration:none;}#nav a:hover {color:#FFF;text-decoration:none;font-weight:bold;}/*==================二级目录===================*/#nav li ul {list-style:none;text-align:left;}#nav li ul li{background: #EBEBEB; /*二级目录的背景色*/}#nav li ul a{ padding-left:20px; width:160px;/* padding-left二级目录中文字向右移动,但Width必须重新设置=(总宽度-padding-left)*/}/*下面是二级目录的链接样式*/#nav li ul a:link {color:#666; text-decoration:none;}#nav li ul a:visited {color:#666;text-decoration:none;}#nav li ul a:hover {color:#F3F3F3;text-decoration:none;font-weight:normal;background:#CC0000;/* 二级onmouseover的字体颜色、背景色*/}/*==============================*/#nav li:hover ul {left: auto;}#nav li.sfhover ul {left: auto;}#content {clear: left; }#nav ul.collapsed {display: none;}-->#PARENT{width:300px;padding-left:20px;}</style></head><body><div id="PARENT"><ul id="nav"><li><a href=> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行] xp风格菜单运行代码框<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">body { }body.menu { background:#383757; margin:0px; font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt; }table.menu { border:0px; font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt; }td.menu { font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt; }img.menu { vertical-align:bottom; border:0px; }a.menu { font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt; color:#215DC6; text-decoration:none; }a:hover.menu { font-size:8pt;color:#428EFF;font-family:"Arial", "Helvetica", "sans-serif"; }.sec_menu { border-left:1px solid gray; border-right:1px solid gray; border-bottom:1px solid gray; overflow:hidden; background:#f8f8f8; }.menu_title {font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt }.menu_title span { position:relative; top:2px; left:8px; color:#494949; font-weight:bold;font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt}.menu_title2 {font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt }.menu_title2 span { position:relative; top:2px; left:8px; color:#428EFF; font-weight:bold; cursor:hand;font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt}a:link {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;text-decoration: none;}a:visited {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;text-decoration: none;}a:hover {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #CCCCCC;text-decoration: none;}</style><!--Start XP Style Menu--><SCRIPT LANGUAGE="Javascript" DEFER="TRUE"> <!--var menuinit=new Array(50),vers;//
一个DIV+CSS菜单,兼容Firefox,分享给大家,大家一齐学习
运行代码框<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>Div+CSS+JS树型菜单,可刷新</title><meta name="description" content="http://www.livepo.com"><style type="text/css"><!--*{margin:0;padding:0;border:0;}body {font-family: arial, 宋体, serif;font-size:12px;}#nav {width:180px; line-height: 24px; list-style-type: none;text-align:left; /*定义整个ul菜单的行高和背景色*/}/*==================一级目录===================*/#nav a {width: 160px; display: block;padding-left:20px;/*Width(一定要),否则下面的Li会变形*/}#nav li {background:#CCC; /*一级目录的背景色*/border-bottom:#FFF 1px solid; /*下面的一条白边*/float:left;/*float:left,本不应该设置,但由于在Firefox不能正常显示继承Nav的width,限制宽度,li自动向下延伸*/}#nav li a:hover{background:#CC0000;/*一级目录onMouseOver显示的背景色*/}#nav a:link {color:#666; text-decoration:none;}#nav a:visited {color:#666;text-decoration:none;}#nav a:hover {color:#FFF;text-decoration:none;font-weight:bold;}/*==================二级目录===================*/#nav li ul {list-style:none;text-align:left;}#nav li ul li{background: #EBEBEB; /*二级目录的背景色*/}#nav li ul a{ padding-left:20px; width:160px;/* padding-left二级目录中文字向右移动,但Width必须重新设置=(总宽度-padding-left)*/}/*下面是二级目录的链接样式*/#nav li ul a:link {color:#666; text-decoration:none;}#nav li ul a:visited {color:#666;text-decoration:none;}#nav li ul a:hover {color:#F3F3F3;text-decoration:none;font-weight:normal;background:#CC0000;/* 二级onmouseover的字体颜色、背景色*/}/*==============================*/#nav li:hover ul {left: auto;}#nav li.sfhover ul {left: auto;}#content {clear: left; }#nav ul.collapsed {display: none;}-->#PARENT{width:300px;padding-left:20px;}</style></head><body><div id="PARENT"><ul id="nav"><li><a href=> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
xp风格菜单
运行代码框<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">body { }body.menu { background:#383757; margin:0px; font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt; }table.menu { border:0px; font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt; }td.menu { font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt; }img.menu { vertical-align:bottom; border:0px; }a.menu { font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt; color:#215DC6; text-decoration:none; }a:hover.menu { font-size:8pt;color:#428EFF;font-family:"Arial", "Helvetica", "sans-serif"; }.sec_menu { border-left:1px solid gray; border-right:1px solid gray; border-bottom:1px solid gray; overflow:hidden; background:#f8f8f8; }.menu_title {font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt }.menu_title span { position:relative; top:2px; left:8px; color:#494949; font-weight:bold;font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt}.menu_title2 {font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt }.menu_title2 span { position:relative; top:2px; left:8px; color:#428EFF; font-weight:bold; cursor:hand;font-family:"Arial", "Helvetica", "sans-serif"; font-size:8pt}a:link {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;text-decoration: none;}a:visited {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #000000;text-decoration: none;}a:hover {font-family: Arial, Helvetica, sans-serif;font-size: 11px;color: #CCCCCC;text-decoration: none;}</style><!--Start XP Style Menu--><SCRIPT LANGUAGE="Javascript" DEFER="TRUE"> <!--var menuinit=new Array(50),vers;//
上一个:仿淘宝网站的导航标签效果!下一个:web2.0中通过li 列表信息怎么实现一行多列?