我的 div 在 chrome(最新版本)中重叠,它们在 Firefox 和 Internet Explorer 中都很好。我做了一个真正快速和简化的jsfiddle,所以你可以明白我的意思,如果用谷歌浏览器打开你可以看到它重叠。有谁知道发生了什么?我尝试放入一个“清晰”的 div,但似乎没有做任何事情。我是初学者,所以请记住这一点。谢谢你。
<div id="container">
<div id="thumbnails">
<div class="web" id="art1">
<img src="http://www.warrenphotographic.co.uk/photography/bigs/03534-Silver-tabby-cat-white-background.jpg" id="img1"/>
<div class="caption1">
<p id="thumbnailTitle">Title</p>
<p id="thumbnailSubtitle">SUBTITLE</p>
</div>
</div>
<div class="graphic" id="art2">
<img src="http://www.southbham.cats.org.uk/uploads/images/pages/cat-stalking-crop.jpg" id="img2"/>
<div class="caption2">
<p id="thumbnailTitle">Title</p>
<p id="thumbnailSubtitle">SBTITLE</p>
</div>
</div>
<div class="web" id="art3">
<img src="http://upload.wikimedia.org/wikipedia/commons/d/d4/Cat_March_2010-1a.jpg" id="img3"/>
<div class="caption3">
<p id="thumbnailTitle">Title</p>
<p id="thumbnailSubtitle">SUBTTLE</p>
</div>
</div>
<div class="clear"></div>
<div class="illustration" id="art4">
<img src="http://media.npr.org/assets/img/2012/09/20/stripey-kitty-d1332c13945e17c5add3810e5ca39c269af872b8-s6-c10.jpg" id="img4"/>
<div class="caption4">
<p id="thumbnailTitle">Title</p>
<p id="thumbnailSubtitle">SUBTITLE</p>
</div>
</div>
<div class="graphic" id="art5">
<img src="http://adam1cor.files.wordpress.com/2011/10/cat1.jpg?w=300&h=300" id="img5"/>
<div class="caption5">
<p id="thumbnailTitle">Title</p>
<p id="thumbnailSubtitle">SUBTITLE</p>
</div>
</div>
</div>
</div>
CSS
#container {
width:80%;
}
.clear {
clear: both;
padding:5ex;
}
div #art1, #art2, #art3, #art4, #art5 {
width: 20%;
height: 100px;
display: inline-block;
margin: 5px;
cursor: pointer;
}
div img {
opacity: 0.5;
height: 70%;
}
.caption1, .caption2, .caption3, .caption4, .caption5, .caption6, .caption7, .caption8 {
margin-top: -5px;
width: 100%;
display: inline-block;
height:40px;
}
.caption4 {
margin-top: -4px;
}
#thumbnailTitle {
font-family: 'Open Sans';
color: #a5a4a4;
font-size: 0.9em;
letter-spacing: 1px;
font-weight: 600;
margin:0px 0 10px 0;
}
#thumbnailSubtitle {
font-family: 'Open Sans';
color: #a5a4a4;
font-size: 0.8em;
font-weight: normal;
letter-spacing: 1px;
margin:-10px 0 50px 0;
padding-bottom: 20px;
}
div img {
width: 100%;
height: 100%;
}
#thumbnails div#art4 {
width: 40.4%;
}