다양한 내용으로 동일한 높이가 필요한 3 개의 상자가 있습니다. 나는 이것을 달성하기 위해 display : table을 사용하고있다. 버튼을 컨테이너의 아래쪽에 수직으로 정렬해야합니다. 단추 너비도 변경 될 수 있습니다. 나는 성공적으로 수직 정렬을 할 수 없었습니다.display : table을 사용하는 컨테이너의 맨 아래에 요소를 정렬하십시오.
http://codepen.io/simply-simpy/pen/kBaHt
<div id="cta-3-col" class="cta-3-col">
<div class="container">
<div class="cta">
<figure>
<img src="http://lorempixel.com/200/100/" alt="">
<figcaption>
<h2>CTA 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing </p>
</figcaption>
</figure>
<a href="#" class="btn " role="button">Follow<i></i></a>
</div>
<div class="cta">
<figure>
<img src="http://lorempixel.com/200/100/" alt="">
<figcaption>
<h2>CTA 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt magna aliqua sed do edunt ut labore et dolore magna aliqua. </p>
</figcaption>
</figure>
<a href="#" class="btn" role="button">Partner With Us<i></i></a>
</div>
<div class="cta">
<figure>
<img src="http://lorempixel.com/200/100/" alt="">
<figcaption>
<h2>CTA 3</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
</figcaption>
</figure>
<a href="#" class="btn" role="button">Learn<i></i></a>
</div>
</div>
</div>
.cta {
background: #fff;
display: table-cell;
width: 270px;
padding: 0 0 30px;
}
.cta-3-col {
background: gray;
text-align: center;
border-spacing: 10px;
}
.container {
display: table;
width: 1000px;
margin: 0 auto;
}
.btn {
background: blue;
color: #fff;
padding: 10px;
}
I을 훨씬 쉬울 거라고 생각해. "position : relative;"를 추가합니다. 컨테이너에 "position : aboslute;"를 사용하십시오. 아래쪽 px 값 –
@ AlvaroMenéndez - 단추를 가운데 맞춤해야하며 너비가 가변적이어야합니다. 그래서, 나는이 것이 얼마나 잘 작동 할 지 확신하지 못합니다. –
지금은 위치 절대 값 방법과 jQuery를 사용하여 오프셋을 설정하고 있습니다. 누구든지 CSS가있는 경우에만 더 나은 방법이 있다면 알려 주시기 바랍니다. –