0
我有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;
}