我有三個相鄰寬度相等的div,我試圖弄清楚爲什麼第一個裏面有一個額外的按鈕的內容推倒了另外兩個div。這是顯示問題嗎?在嘗試手動對齊它們之前,我寧願理解原因。謝謝!div內容向下推相鄰的divs
這裏是我的標記:
<div id="events-cont">
<div class="events-row">
<div class="event-card">
<img src="http://placeholdit.imgix.net/~text?txtsize=36&txt=Event%20Photo&w=382&h=275" />
<div class="event-card-info">
<h1>Event title</h1>
<h2>Event date</h2>
<h2>Event venue</h2>
<p>
Event description
<a href="#">Learn More</a>
</p>
<a class="tickets-button" href="#">Buy Tickets</a>
</div>
</div>
<div class="event-card">
<img src="http://placeholdit.imgix.net/~text?txtsize=36&txt=Event%20Photo&w=382&h=275" />
<div class="event-card-info">
<h1>Event title</h1>
<h2>Event date</h2>
<h2>Event venue</h2>
<p>
Event description
<a href="#">Learn More</a>
</p>
</div>
</div>
<div class="event-card">
<img src="http://placeholdit.imgix.net/~text?txtsize=36&txt=Event%20Photo&w=382&h=275" />
<div class="event-card-info">
<h1>Event title</h1>
<h2>Event date</h2>
<h2>Event venue</h2>
<p>
Event description
<a href="#">Learn More</a>
</p>
</div>
</div>
</div>
</div>
CSS:
* {
box-sizing: border-box;
}
#events-cont {
padding: 30px 0;
.events-row {
.event-card {
padding: 0 15px;
display: inline-block;
width: 33%;
img {
display: block;
width: 100%;
}
.event-card-info {
padding: 15px;
min-height: 300px;
text-align: left;
background: #ededed;
.tickets-button {
display: inline-block;
margin: 30px;
padding: 10px 30px;
font-size: 1.8em;
}
}
}
}
}
演示:http://codepen.io/ourcore/pen/eBWxLz