css下拉菜单样式代码,css下拉菜单样式代码不见了
css下拉菜单代码
我给楼主看了一下```你要的效果没说清楚`如果想显示出下拉列表直接删掉 #menu li dd{display:none;
为冠县等地区用户提供了全套网页设计制作服务,及冠县网站建设行业解决方案。主营业务为成都做网站、成都网站设计、冠县网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
}
就可以了。如果想鼠标移动后,出现下拉列表,我没看到楼主定义这个类型,所以给楼主一个我以前写的,仅供参考。
.imcm ul,.imcm li,.imcm div,.imcm span,.imcm a{text-align:left;vertical-align:top;padding:0px;margin:0;list-style:none outside none;border-style:none;background-image:none;clear:none;float:none;display:block;position:static;overflow:visible;line-height:normal;}
.imcm li a img{display:inline;border-width:0px;}
.imcm span{display:inline;}
.imcm .imclear,.imclear{clear:both;height:0px;visibility:hidden;line-height:0px;font-size:1px;}.imcm .imsc{position:relative;}.imcm .imsubc{position:absolute;visibility:hidden;}.imcm li{list-style:none;font-size:1px;float:left;}.imcm ul ul li{width:100;float:left !important;}
.imcm a{display:block;position: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:block;position:relative;left:0px;font-size:1px;line-height:1px;height:0px;width:1px;float:right;}
.imcm .imea span{display:block;position:relative;font-size:1px;line-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:1px; height:12px; left:0px; top:0px; background-repeat:no-repeat;background-position:top left;}
#imenus0 li:hover .imeam span,#imenus0 li a.iactive .imeamj span {background-image:url(bg-daohangS.jpg); background-repeat:no-repeat;background-position:top left;}
/* --[[ Sub Expand Icons ]]-- */
#imenus0 ul .imeas span,#imenus0 ul .imeasj span {background-image:url(stub_arrow_right.gif); width:6px; height:8px; left:0px; top:3px; background-repeat:no-repeat;background-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-repeat;background-position:top left;}
/* --[[ Main Container ]]-- */
#imouter0 {background-color:#95D4CC; border-style:none; border-color:#CCCCCC; border-width:1px; padding:0px; margin:0px; }
/* --[[ Sub Container ]]-- */
#imenus0 li ul {background-color:#95d4cc; border-style:solid; border-color:#687a54; border-width:1px; padding:5px 8px 5px 5px; margin:0px; }
/* --[[ Main Items ]]-- */
#imenus0 li a, #imenus0 .imctitle {height:16px; background-color:#95D4CC; color:#000; text-align:left; font-family:Arial; font-size:12px; font-weight:normal; text-decoration:none; padding:3px 6px 1px; margin:0px 5px 0px 0px; }
/* [hover] - These settings must be duplicated for IE compatibility.*/
#imenus0 li:hovera {background-color:#5B9890; text-decoration:none; }
#imenus0 li a.ihover, .imde imenus0 a:hover {background-color:#95d4cc; text-decoration:none; }
/* [active] */
#imenus0 li a.iactive {}
/* --[[ Sub Items ]]-- */
#imenus0 ul a, #imenus0 .imsubc li .imctitle {height:auto; background-color:transparent; color:#000; text-align:left; font-size:11px; font-weight:normal; text-decoration:none; border-style:solid; border-color:#95d4cc; border-width:1px 0px; padding:2px 5px; margin:0px; }
/* [hover] - These settings must be duplicated for IE comptatibility.*/
#imenus0 ul li:hovera {background-color:#5B9890; text-decoration:none; border-color:#687a54; }
#imenus0 ul li a.ihover {background-color:#5B9890; text-decoration:none; border-color:#687a54; }
/* [active] */
#imenus0 ul li a.iactive {}
在CSS中定义下拉菜单的代码
参考一下这个
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""!--定义过渡型DOCTYPE--
html xmlns="" lang="gb2312"!--定义名字空间--
head
title二级菜单/title!--标题栏--
meta http-equiv="Content-Type" content="text/html; charset=gb2312" /!--定义语言编码--
meta http-equiv="Content-Language" content="gb2312" /!--针对老版浏览器定义语言编码--
meta name="description" content="下拉菜单,CSS,布局" /!--简介--
meta content="下拉,菜单,CSS,布局" name="keywords" /!--关键词--
!--CSS样式开始--
style type=text/css
*{
margin:0;
padding:0;
border:0;
}
html{
background:#bfc4c7;/*背景颜色*/
}
body{
font:12px/150% '宋体';
margin:0 auto;
width:770px;
text-align:center;
}
#menu,#nav,#footer{
clear:both;
}
#nav{
padding-left:20px;
text-align:left;
background:#a60;
}
#footer{
background:#a30;
}
#logo,#banner,#mail,#left,#middle,#right{
float:left;
width:180px;
background:#f00;
}
#logo,#banner,#mail{
height:60px;
}
#banner{
width:468px;
background:#f60;
}
#mail{
width:122px;
background:#f90;
}
#left,#right{
width:200px;
}
#left{
background:#093;
}
#middle{
width:370px;
background:#063;
}
#right{
background:#033;
}
/*menu部分*/
#menu{
margin:0;
position:relative;
width:770px!important;
}
#menu ul{
list-style:none;
}
#menu li {
float:left;
position:relative;
}
#menu ul ul {
visibility:hidden;
position:absolute;
left:0px;
top:30px;
}
#menu table{
position:absolute;
left:0;
top:0;
}
#menu ul li:hover ul,#menu ul a:hover ul{
visibility:visible;
}
#menu a{
display:block;
text-align:center;
text-decoration:none;
width:77px;
height:30px;
color:#000;
line-height:30px;
background:#c9c9a7;
}
#menu a:hover{
color:#fff;
background:#b3ab79;
}
#menu ul ul li {
clear:both;
text-align:left;
}
#menu ul ul li a{
display:block;
width:77px;
height:30px;
background:#faeec7;
color:#000;
}
#menu ul ul li a:hover{
background:#dfc184;
color:#000;
}
/style!--CSS样式结束--
/head!--网页头部结束--
body!--网页主体开始--
div id="menu"
ul
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
li
a href=""第一分类!--[if IE 7]!--/a!--![endif]--!--[if lte IE 6]
table
tr
td![endif]--
ul
lia href=""XHTML/a/li
lia href=""CSS/a/li
lia href=""PHP/a/li
lia href=""MySQL/a/li
lia href=""Fireworks/a/li
lia href=""Photoshop/a/li
lia href=""Flash/a/li
lia href=""Illustrator/a/li
/ul!--[if lte IE 6]
/td
/tr
/table
/a![endif]--
/li
/ul
/div
/body!--网页主体结束--
/html
这是下拉菜单问题的css代码
!doctype html
html
head
meta charset="utf-8"
title无标题文档/title
style type="text/css"
* {
margin: 0;
padding: 0;
}
body {
font-family: Arail;
font-size: 15px;
}
.nav {
margin: 20px;
}
.nav ul ul {
display: none;
}
.nav ul li {
float: left;
position: relative;
width: 80px;
text-align: center;
}
.nav li a {
display: block;
color: white;
text-decoration: none;
background: #000;
padding: 10px;
font-size: 15px;
}
.nav li a:hover {
color: #ffffff;
background: #003399;
}
.nav ul li:hover ul {
display: block;
position: absolute;
top: 38px;
left: 0px;
}
ul {
list-style-type: none;
}
.nav li ul li a {
margin-top: 0;
background: red;
color: #000;
}
.nav li ul li a:hover {
color: #FFF;
background: #000;
}
/style
/head
body
div class="nav"
ul
lia href="#"源码下载/a
ul
lia href="/"CodeFans/a/li
lia href="#"banana/a/li
/ul
/li
lia href="#"网站首页/a
ul
lia href="#"CodeFans/a/li
lia href="#"cattle/a/li
/ul
/li
lia href="#"ASP/a
ul
lia href="#"ASP/a/li
lia href="#"cattle/a/li
/ul
/li
lia href="#"PHP/a
ul
lia href="/"AJAX/a/li
lia href="#"dog/a/li
/ul
/li
lia href="#"ASP.NET/a
ul
lia href="#"ASP/a/li
lia href="#"cattle/a/li
lia href="/"dog/a/li
/ul
/li
lia href="#"AJAX/a
ul
lia href="#"MOOTS/a/li
lia href="#"DOTS/a/li
/ul
/li
lia href="#"JQUERY/a
ul
lia href="#"JAVA/a/li
lia href="/"cattle/a/li
lia href="/"EXTS/a/li
lia href="#"cat/a/li
/ul
/li
lia href="#"CHINA/a
ul
lia href="#"CHINA/a/li
lia href="#"PHP/a/li
/ul
/li
lia href="#"USA/a
ul
lia href="/"USA/a/li
lia href="/"cattle/a/li
lia href="#"chicken/a/li
/ul
/li
/ul
/div
/body
/html
效果如下:希望能帮助你
CSS技巧分享:如何用css制作横排二级下拉菜单
工具/材料
notepad++
浏览器
打开Notepad++,先输入个页面框架
!DOCTYPE html
html xmlns=""
hade
/hade
body
/body
框架好了,那么就该定义页面的title,关键词keyword,和描述description
meta charset="UTF-8" content="text/html" http-equiv="content-type"
title纯css二级导航下拉菜单/title
meta name="keyword" content="搜狗略懂"
meta name="description" content="描述"
这些内容只能在head/head中完成。
定义页面使用的css样式,也是需要在head里定义的。
style type="text/css"
* {
margin:0;
padding:0;
}
.jiao ul li a:hover{
color:#red;
}
ul, li {
list-style:none;
}
a {
text-decoration:none;
}
.jiao {
border:5px solid #pink;
border-right:none;
overflow:hidden;
float:left;
margin:200px 0 0 600px;
}
.jiao ul li ul li a {
border-right:solid;
border-top:2px dotted #666;
background:#black;
}
.jiaoulli { float:left;}
.jiao ul li a { width:150px; height:80px; text-align:center; line-height:100px; display:block; border-right:5px solid #red; background:#red; color:#red;}
.jiao ul li ul { position:absolute; display:none;}
.jiao ul li:hover ul{ display:block; }
.jiaoulliulli { float:none;}
!--navul只选择nav下一级里面的ul元素
nav ul选择nav内所包含的所有ul元素
navul比nav ul限定更严格,必须后面的元素只比前面的低一个级别。
这里根据你的需求来自己定义。
--
/style
添加一个DIV标签,在页面中划分出一个块来,用来显示。
div中所用的样式为刚才咱们声明的样式“jiao”这个盒子来描述
然后使用无序标签ul+样式li 来实现模块。
div class="jiao"
ul
lia href="#"搜狗略懂/a
ul
lia href="#"搜狗问问/a/li
lia href="#"搜狗输入法/a/li
lia href="#"搜狗浏览器/a/li
lia href="#"搜狐/a/li
/ul
/div
放上全部的代码吧,可以参考一下啊,
!DOCTYPE html
html xmlns=""//允许你通过一个网址来识别你的标记
head
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
meta name="keyword" content="利用css实现下拉菜单"
meta name="description" content="搜狗略懂、css分享"
titlecss实现下拉导航栏菜单/title
style type="text/css"
* {
margin:0;
padding:0;
}
.jiao ul li a:hover{
color:#red;
}
ul, li {
list-style:none;
}
a {
text-decoration:none;
}
.jiao {
border:5px solid #pink;
border-right:none;
overflow:hidden;
float:left;
margin:200px 0 0 600px;
}
.jiao ul li ul li a {
border-right:solid;
border-top:2px dotted #666;
background:#black;
}
.jiaoulli { float:left;}
.jiao ul li a { width:150px; height:80px; text-align:center; line-height:100px; display:block; border-right:5px solid #red; background:#red; color:#red;}
.jiao ul li ul { position:absolute; display:none;}
.jiao ul li:hover ul{ display:block; }
.jiaoulliulli { float:none;}
!--navul只选择nav下一级里面的ul元素
nav ul选择nav内所包含的所有ul元素
navul比nav ul限定更严格,必须后面的元素只比前面的低一个级别。
这里根据你的需求来自己定义。
--
/style
/head
body
div class="jiao"
ul
lia href="#"搜狗略懂/a
ul
lia href="#"搜狗问问/a/li
lia href="#"搜狗输入法/a/li
lia href="#"搜狗浏览器/a/li
lia href="#"搜狐/a/li
/ul
/li
/ul
/div
/body
/html
如果要添加更多的菜单,只需要后边继续添加ul/li即可
特别提示
写代码过程中一定要记得换行,开头留空,否则过后找东西,连你自己都不知道写的是什么。何谈从哪里找起?
文章标题:css下拉菜单样式代码,css下拉菜单样式代码不见了
URL标题:http://hbruida.cn/article/dsdgsds.html