html 加载多个class,有的只加载了一个,有的两个都加载了,为何?_html/css_WEB-ITnose
Jun 24, 2016 am 11:37 AM spe_top banner_top 和 spe_top banner_top 这两个分别只有一个有效
header_img spe_img 两个都有效
HTML 代码
<div class="spe_header header" style="height:150px;"> <div class="spe_top banner_top"> <div class="header_menu"> <input type="button" id="banner_open" /> </div> <div class="banner spe_ban"> <div class="banner_x"><input type="button" id="banner_close" /></div> <div class="banner_main speban_ul"> <ul> <li><a href="index.html">HOME</a></li> <li><a href="about.html">ABOUT</a></li> <li><a href="service.html">SERVICE</a></li> <li><a href="gallery.html">GALLERY</a></li> <li><a href="blog.html">BLOG</a></li> <li><a href=""></a>CONTACT</li> </ul> </div> </div> </div> <div class="header_img spe_img"></div></div>
CSS代码
.spe_header{height:150px;}
.header{background:#0CC repeat;height:700px;color:white;}
.spe_top{height:150px;}
.banner_top{background:rgb(0, 229, 238) repeat;height:700px;position:relative;top:0;}
.header_img{margin:0 auto;width:70%;height:800px;background:url(../images/banner.jpg) no-repeat;background-size:cover;position:absolute;top:0;left:230px;}
.spe_img{height:150px;}
回复讨论(解决方案)
.spe_header{height:150px;}.header{background:#0CC repeat;height:700px;color:white;}.banner_top{background:rgb(0, 229, 238) repeat;height:700px;position:relative;top:0;}.header_img{margin:0 auto;width:70%;height:800px;background:url(../images/banner.jpg) no-repeat;background-size:cover;position:absolute;top:0;left:230px;}.spe_img{height:150px;}.spe_top{height:150px;}/*同样优先级的选择器,相同属性的样式,写在后面的会覆盖前面的,要把这行放到后面*/
不是这个意思啊,是有个选择器根本没效果,开始放不了图
spe_top banner_top 和 spe_top banner_top 这两个分别只有一个有效
header_img spe_img 两个都有效
.spe_header{height:150px;}.header{background:#0CC repeat;height:700px;color:white;}.banner_top{background:rgb(0, 229, 238) repeat;height:700px;position:relative;top:0;}.header_img{margin:0 auto;width:70%;height:800px;background:url(../images/banner.jpg) no-repeat;background-size:cover;position:absolute;top:0;left:230px;}.spe_img{height:150px;}.spe_top{height:150px;}/*同样优先级的选择器,相同属性的样式,写在后面的会覆盖前面的,要把这行放到后面*/
不是这个意思啊,是有个选择器根本没效果,开始放不了图
spe_top banner_top 和 spe_top banner_top 这两个分别只有一个有效
header_img spe_img 两个都有效
楼主什么结贴率????
哦。。。。。
被覆盖了。
.spe_top{height:150px;}
.banner_top{background:rgb(0, 229, 238) repeat;height:700px;position:relative;top:0;}
第一个肯定不起作用 了,你看看你写的第二个样式就知道了。
赶紧结贴了吧,我都不好意思回复了!
感谢大家,主要是注释的问题,优先级也没怎么搞清楚,问题已解决

인기 기사

인기 기사

뜨거운 기사 태그

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











공식 계정 웹 페이지의 캐싱 업데이트에 어려움 : 버전 업데이트 후 사용자 경험에 영향을 미치는 이전 캐시를 피하는 방법은 무엇입니까?

HTML5 양식 유효성 검사 속성을 사용하여 사용자 입력을 유효성있게하려면 어떻게합니까?

웹 페이지의 PNG 이미지에 뇌졸중 효과를 효율적으로 추가하는 방법은 무엇입니까?

HTML5의 크로스 브라우저 호환성에 대한 모범 사례는 무엇입니까?

& lt; iframe & gt; 꼬리표? 보안을 사용할 때 보안 고려 사항은 무엇입니까?

iframes 사용의 보안 영향은 무엇이며 어떻게 완화 할 수 있습니까?
