我有 3 个 div,都设置了高度和宽度。middel 有一条额外的线,但它仍然在父 div 的 250px 内。然而,它会导致两侧的两个 div 向下移动一点。有人可以解释为什么要这样做,以便我可以理解前进吗?
<div id="eventListBox">
<div class="eventListItemBox">
<img src="./icons/bluedude.png" />
<h1>Test Item 1</h1>
<h2>Jan 6th, 2012</h2>
<h2>5/11</h2>
</div>
<div class="eventListItemBox">
<img src="./icons/cookies.png" />
<h1>Very long title to cause wrap on line</h1>
<h2>Jan 15th, 2012</h2>
<h2>2/9</h2>
</div>
<div class="eventListItemBox">
<img src="./icons/cookies.png" />
<h1>Test item 3</h1>
<h2>Jan 15th, 2012</h2>
<h2>2/9</h2>
</div>
</div>
CSS:
#eventListBox{
margin: 0px;
padding: 0px;
position: absolute;
top: 150px;
left: 75px;
right: 75px;
text-align: center;
background-color: rgba(0,0,0,0.25);
}
.eventListItemBox{
display: inline-block;
margin: 0px;
padding: 0px;
width: 250px;
height: 250px;
background-color: rgba(0,0,0,0.25);
}
.eventListItemBox h1{
margin: 0px;
padding: 0px;
font-size: 1.5em;
font-weight: normal;
}
.eventListItemBox h2{
margin: 0px;
padding: 0px;
font-size: 1.2em;
font-weight: normal;
}