我可以在IE中完成这项工作吗?

时间:2011-01-16 15:06:33

标签: css

嗨我刚刚用子菜单构建了一个CSS菜单它似乎在Firefox中运行得很好..但是IE似乎有问题..它只是不起作用。有人可以告诉我解决吗?继承人CSS

body
{
margin:0px;
padding:0px;
font-family:calibri;
font-size:16px;
}

#navigation
{
width:100%;
height:40px;
background-color:#999;
}

#navigation ul
{
margin:0px;
padding:0px;
}

#navigation ul li
{
display:inline;
height:28px;
width:15.7%;
float:left;
list-style:none;
border-style:solid;
border-width:1px;
border-color:#c3c3c3;
padding:5px 5px 5px 5px;
margin-left:0px 0px 0px 0px;
position:relative;
text-align:center;
}

#navigation ul li:hover
{
color:#fff;
background-color:red;
}

#navigation li a
{
color:#fff;
text-decoration:none;
}

#navigation li a:hover
{
color:black;
text-decoration:underline;
}

#navigation li ul
{
margin:0px;
padding:0px;
display:none;
position:absolute;
Right:0px;
top:39px;
padding:0px 0px 0px 0px;
}

#navigation li:hover ul
{
display:block;
width:160px;
 border-style:solid;
 border-width:0px;
 border-color:red;
 background-color:none;
 padding-right:4px;
}

#navigation li li
{
list-style:none;
display:list-item;
 border-style:solid;
 border-width:0px;
 border-color:blue;
 background-color:yellow;
 width:100%;
 margin: 2px 2px 2px 2px;
 padding:0px 0px 0px 0px;
 text-align:left;
}

#navigation li li:hover
{
list-style:none;
display:list-item;
border-style:solid;
border-width:0px;
border-color:none;
background-color:none;
width:100%;
text-align:left;
}

#sbmenu
{
border-style:solid;
border-width:0px;
border-color:gray;
background-color:#b1b1b1;
width:97%;
height:90%;
margin:0px 0px 0px 0px;
padding:0px 0px 0px 5px;
text-align:left;
}

#sbmenu:hover
{
background-color:#c3c3c3;
}

1 个答案:

答案 0 :(得分:1)

也许在html文档的第一行添加它会有所帮助:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

或过渡(也必须在html文档的第一行添加)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">