css下拉菜单代码

html-css030

css下拉菜单代码,第1张

我给楼主看了一下```你要的效果没说清楚`如果想显示出下拉列表直接删掉 #menu li dd{display:none

}

就可以了。如果想鼠标移动后,出现下拉列表,我没看到楼主定义这个类型,所以给楼主一个我以前写的,仅供参考。

.imcm ul,.imcm li,.imcm div,.imcm span,.imcm a{text-align:leftvertical-align:toppadding:0pxmargin:0list-style:none outside noneborder-style:nonebackground-image:noneclear:nonefloat:nonedisplay:blockposition:staticoverflow:visibleline-height:normal}

.imcm li a img{display:inlineborder-width:0px}

.imcm span{display:inline}

.imcm .imclear,.imclear{clear:bothheight:0pxvisibility:hiddenline-height:0pxfont-size:1px}.imcm .imsc{position:relative}.imcm .imsubc{position:absolutevisibility:hidden}.imcm li{list-style:nonefont-size:1pxfloat:left}.imcm ul ul li{width:100float:left !important}

.imcm a{display:blockposition:relative}

.imcm ul .imsc,.imcm ul .imsubc {z-index:10}

.imcm ul ul .imsc,.imcm ul ul .imsubc{z-index:20}

.imcm ul ul ul .imsc,.imcm ul ul ul .imsubc{z-index:30}

.imde ul li:hover .imsubc{visibility:visible}

.imde ul ul li:hover

.imsubc{visibility:visible}

.imde ul ul ul li:hover

.imsubc{visibility:visible}

.imde li:hover ul .imsubc{visibility:hidden}

.imde li:hover ul ul .imsubc{visibility:hidden}

.imde li:hover ul ul ul .imsubc{visibility:hidden}

.imcm .imea{display:blockposition:relativeleft:0pxfont-size:1pxline-height:1pxheight:0pxwidth:1pxfloat:right}

.imcm .imea span{display:blockposition:relativefont-size:1pxline-height:0px}.dvs,.dvm{border-width:0px}/*\*//*/.imcm .imea{visibility:hidden}/**/</style><!--[if IE]><style type="text/css">.imcm .imea span{position:absolute}.imcm .imclear,.imclear{display:none}.imcm{zoom:1} .imcm li{curosr:hand} .imcm ul{zoom:1}.imcm a{zoom:1}</style><![endif]--><!--[if gte IE 7]><style type="text/css">.imcm .imsubc{background-image:url(ie_css_fix)}</style><![endif]--><!--end-->

<!--[imstyles] *** Infinite Menu Styles: Keep this section in the document head for full validation. -->

<style type="text/css">

/* --[[ Main Expand Icons ]]-- */

#imenus0 .imeam span,#imenus0 .imeamj span {background-image:url(bg-daohangS.jpg)width:1pxheight:12pxleft:0pxtop:0pxbackground-repeat:no-repeatbackground-position:top left}

#imenus0 li:hover .imeam span,#imenus0 li a.iactive .imeamj span {background-image:url(bg-daohangS.jpg)background-repeat:no-repeatbackground-position:top left}

/* --[[ Sub Expand Icons ]]-- */

#imenus0 ul .imeas span,#imenus0 ul .imeasj span {background-image:url(stub_arrow_right.gif)width:6pxheight:8pxleft:0pxtop:3pxbackground-repeat:no-repeatbackground-position:top left}

#imenus0 ul li:hover .imeas span,#imenus0 ul li a.iactive .imeasj span {background-image:url(stub_arrow_right.gif)background-repeat:no-repeatbackground-position:top left}

/* --[[ Main Container ]]-- */

#imouter0 {background-color:#95D4CCborder-style:noneborder-color:#CCCCCCborder-width:1pxpadding:0pxmargin:0px}

/* --[[ Sub Container ]]-- */

#imenus0 li ul {background-color:#95d4ccborder-style:solidborder-color:#687a54border-width:1pxpadding:5px 8px 5px 5pxmargin:0px}

/* --[[ Main Items ]]-- */

#imenus0 li a, #imenus0 .imctitle {height:16pxbackground-color:#95D4CCcolor:#000text-align:leftfont-family:Arialfont-size:12pxfont-weight:normaltext-decoration:none padding:3px 6px 1pxmargin:0px 5px 0px 0px}

/* [hover] - These settings must be duplicated for IE compatibility.*/

#imenus0 li:hover>a {background-color:#5B9890text-decoration:none}

#imenus0 li a.ihover, .imde imenus0 a:hover {background-color:#95d4cctext-decoration:none}

/* [active] */

#imenus0 li a.iactive {}

/* --[[ Sub Items ]]-- */

#imenus0 ul a, #imenus0 .imsubc li .imctitle {height:autobackground-color:transparentcolor:#000text-align:leftfont-size:11pxfont-weight:normaltext-decoration:noneborder-style:solidborder-color:#95d4ccborder-width:1px 0pxpadding:2px 5pxmargin:0px}

/* [hover] - These settings must be duplicated for IE comptatibility.*/

#imenus0 ul li:hover>a {background-color:#5B9890text-decoration:noneborder-color:#687a54}

#imenus0 ul li a.ihover {background-color:#5B9890text-decoration:noneborder-color:#687a54}

/* [active] */

#imenus0 ul li a.iactive {}

将CSS用变量写到页面中去

比如你有3个CSS

css1.css2.css3

<%

CssUrl=Request("CssName")

if CssUrl="" then

CssUrl="默认的css"

else

CssUrl=Request("CssName")

End if

%>

加载的时候加载默认的一个随便那个都可以了

<link id="CssInclude" href="<%=CssUrl%>" rel="stylesheet" type="text/css">

然后再下来菜单中

<form name=frm1 method=post>

<select name="CssName" onchange="js:frm1.submit()">

<option value=<%=css1地址%>selected>css1</option>

<!--默认css样式-->

<option value=<%=css2地址%>>css2</option>

<option value=<%=css3地址%>>css3</option>

</select></form>

你是什么写的页面

asp按照我说做

如果是html

<link id="CssInclude" href="默认css地址" rel="stylesheet" type="text/css">

然后再下来菜单中

<form name=frm1 method=post>

<select name="CssName" onchange="document.all.CssInclude.href=this.valuelocation.location.reload()">

<option value=<%=css1地址%>selected>css1</option>

<!--默认css样式-->

<option value=<%=css2地址%>>css2</option>

<option value=<%=css3地址%>>css3</option>

</select></form>

使用HTML和CSS制作下拉菜单的方法如下:

1、编写带有div导航的html代码:

2、使用class=“nav”属性的‘div’标签作为菜单的容器。在截图中,在图示的HTML代码中,一个简单的无序列表(ul)来表示主菜单项。

3、在主菜单区域中添加链接。在本步骤中,在无序列表(ul)每一项上添加链接。

4、在“关于我们(About Us)”下方LI标签内添加一个无序列表,它代表其子菜单的链接。

5、制作导航css: