css样式冲突问题。急
在网页中嵌入一个外连样式,nav.css文件。为何之前定义的导航位置就变了?是不是有冲突?我只是用link嵌入。网页内容没有改,导航就变了。nav.css文件内容:.dh...
在网页中嵌入一个外连样式,nav.css文件。为何之前定义的导航位置就变了?是不是有冲突?我只是用link 嵌入。网页内容没有改,导航就变了。
nav.css文件内容:.dh {
position:absolute;
width:99px;
font-size:12px;
margin:20px auto;
border:0px solid #aaa;
text-align: center;
}
.dh ul{
list-style:none;
}
.dh li a{
display:block;
width:89px;
position:relative;
text-align:center;
text-decoration:none;
color:#000;
padding:2px;
border:0px solid #fff;
height: 65px;
top: 0px;
background-repeat: no-repeat;
background-position: center center;
}
.dh li {
text-align: center;
vertical-align: middle;
}
.dh li a:hover{
border:0px solid red;
}
span{
width:0;
height:0;
overflow:hidden;
border:6px solid #fff;
}
.dh li a:hover span.left{
position:absolute;
top:28px;
left:9px;
border-left-color:red;
}
之前导航的css文件:*{margin:0;padding:0;border:0;}
#nav {z-index:3000;
line-height: 24px;
list-style-type: none;
margin-top: -70px;
margin-left: 300px;
font-size: 13px;
color: #FFFFFF;
}
#nav a {
display: block; width: 80px; text-align:center;
}
#nav a:link {
color:#CCCCCC;
text-decoration:none;
}
#nav a:visited {
color:#FFFFFF;
text-decoration:none;
}
#nav a:hover {
color:#FFF;
text-decoration:none;
}
#nav li {
float: left;
width: 80px;
margin-top: -7px;
}
#nav li a:hover{
background-image: url(../image/dh.gif);
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center center;
filter: Alpha(Opacity=80, FinishOpacity=10, Style=1, startx=0, starty=0,finishx=0,finishy=70 );
color: #FFFFFF;
}
#nav li ul {z-index:3000;
line-height: 32px;
list-style-type: none;
text-align:left;
left: -999em;
width: 180px;
position: absolute;
margin-left: 0px;
}
#nav li ul li {z-index:3000;
float: left;
width: 150px;
background: #1e3b4e;
filter: Alpha(Opacity=30, FinishOpacity=30, Style=0, );
margin-top: 0px;
line-height: 2;
}
#nav li ul a{
display: block; width: 178px;width: 156px;text-align:left;padding-left:24px;
}
#nav li ul a:link {
color:#FFFFFF;
text-decoration:none;
}
#nav li ul a:visited {
color:#FFFFFF;
text-decoration:none;
}
#nav li ul a:hover {
color:#FFFFFF;
text-decoration:none;
font-weight:normal;
background:#e65c08;
position:relative;
width: 156px;
}
#nav li:hover ul {
left: auto;
}
#nav li.sfhover ul {
left: auto;
}
#content {
clear: left;
}
#nav li ul li a {
position:relative;
font-size: 12px;
}
为什么啊? 郁闷的快吐血了。。。。。 展开
nav.css文件内容:.dh {
position:absolute;
width:99px;
font-size:12px;
margin:20px auto;
border:0px solid #aaa;
text-align: center;
}
.dh ul{
list-style:none;
}
.dh li a{
display:block;
width:89px;
position:relative;
text-align:center;
text-decoration:none;
color:#000;
padding:2px;
border:0px solid #fff;
height: 65px;
top: 0px;
background-repeat: no-repeat;
background-position: center center;
}
.dh li {
text-align: center;
vertical-align: middle;
}
.dh li a:hover{
border:0px solid red;
}
span{
width:0;
height:0;
overflow:hidden;
border:6px solid #fff;
}
.dh li a:hover span.left{
position:absolute;
top:28px;
left:9px;
border-left-color:red;
}
之前导航的css文件:*{margin:0;padding:0;border:0;}
#nav {z-index:3000;
line-height: 24px;
list-style-type: none;
margin-top: -70px;
margin-left: 300px;
font-size: 13px;
color: #FFFFFF;
}
#nav a {
display: block; width: 80px; text-align:center;
}
#nav a:link {
color:#CCCCCC;
text-decoration:none;
}
#nav a:visited {
color:#FFFFFF;
text-decoration:none;
}
#nav a:hover {
color:#FFF;
text-decoration:none;
}
#nav li {
float: left;
width: 80px;
margin-top: -7px;
}
#nav li a:hover{
background-image: url(../image/dh.gif);
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center center;
filter: Alpha(Opacity=80, FinishOpacity=10, Style=1, startx=0, starty=0,finishx=0,finishy=70 );
color: #FFFFFF;
}
#nav li ul {z-index:3000;
line-height: 32px;
list-style-type: none;
text-align:left;
left: -999em;
width: 180px;
position: absolute;
margin-left: 0px;
}
#nav li ul li {z-index:3000;
float: left;
width: 150px;
background: #1e3b4e;
filter: Alpha(Opacity=30, FinishOpacity=30, Style=0, );
margin-top: 0px;
line-height: 2;
}
#nav li ul a{
display: block; width: 178px;width: 156px;text-align:left;padding-left:24px;
}
#nav li ul a:link {
color:#FFFFFF;
text-decoration:none;
}
#nav li ul a:visited {
color:#FFFFFF;
text-decoration:none;
}
#nav li ul a:hover {
color:#FFFFFF;
text-decoration:none;
font-weight:normal;
background:#e65c08;
position:relative;
width: 156px;
}
#nav li:hover ul {
left: auto;
}
#nav li.sfhover ul {
left: auto;
}
#content {
clear: left;
}
#nav li ul li a {
position:relative;
font-size: 12px;
}
为什么啊? 郁闷的快吐血了。。。。。 展开
4个回答
展开全部
看CSS没有什么冲突。你这样试下吧,新加的CSS中的class .dh 都改成id #dh来提高他的优先级。 或者原来的#nav改成.nav
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
只能CSS怎么看呐
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询