Home  >  Article  >  Web Front-end  >  div背景消失_html/css_WEB-ITnose

div背景消失_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 09:41:131063browse

css div


我有3个div













这3个div在select,unselect和hover时都有背景图片
id=tab3的div在hover时背景消失
css:
.tab3selected {
width: 270px;
height: 60px;
background: url(../images/detail_itinerary_inclusion_hover.jpg) no-repeat;
}
.tab3unselected {
width: 270px;
height: 60px;
background: url(../images/detail_itinerary_inclusion.jpg) no-repeat;
}
.tab3unselected:hover {
background: url(../images/detail_itinerary_inclusion_hover.png) no-repeat;
}
这3个div是一样设置的,只有第3个有问题

回复讨论(解决方案)

把高度和宽度加上就有了
width: 270px;
height: 60px;

先问一下你是用个的IE6吗?

 :hover 当你鼠标经过这个div时,背景色和边框都会发生变化,但是此效果在IE6中不能得到效果,
因为IE6不支持hover伪类。在上面CSS样式中:hover 是给非IE浏览器识别的,因为大多数非IE浏览器都已经支持任意标记的hover伪类了。.hover是给IE6以及以下版本识别的,因为IE6以及一下版本一直都只支持标记的hover伪类(IE7已支持任意标记hover伪类效果)。

div里 没有内容 是不是?那就给添加属性 让他拥有布局吧,不如 会上下外边距发生叠加,成为一条线,当然不会有图片显示了 。如何让他拥有布局,很多方式:设置 width,height,display:block,float等属性都可以

其实我犯了个愚蠢的错误,查了半天,文件名不对,谢谢各位

细心点嘛,先看看图片能不能访问

其实我犯了个愚蠢的错误,查了半天,文件名不对,谢谢各位
既然问题解决,建议楼主结贴

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn