アプリ版:「スタンプのみでお礼する」機能のリリースについて

添付のように3カラムの記事をboxで括って表示します。
記事最下部のボタン位置が記事の長さによってバラバラになるのですが、この高さ位置を揃えるにはどうしたらよいでしょうか?

[html]
<div class="cover">
<div class="box1">
<h2>1カラム</h2>
   <p>○○○○○○○○○○○○○○○
   ○○○○○○○○○○
   ○○○○○○○○
   ○○○○○○○○○○
   ○○○○○○○○○○○○○
   ○○○○○○○○</p>
   <p>ボタンA</p>
</div>
<div class="box2">
<h2>2カラム</h2>
   <p>△△△△△△△△△△△
   △△△△△△△△△△△△
   △△△△△△△△△
   △△△△△△</p>
   <p>ボタンB</p>
</div>
<div class="box3">
<h2>3カラム</h2>
   <p>✕✕✕✕✕✕✕✕✕
   ✕✕✕✕✕✕✕
   ✕✕✕✕✕✕✕✕
   ✕✕✕✕✕✕✕✕✕✕
   ✕✕</p>
   <p>ボタンC</p>
</div>
</div>


[css]
div.cover {
display: table;
width: 100%;
}
div.cover div.box1 {
display: table-cell;
width: 33.3%;
}
div.cover div.box2 {
display: table-cell;
width: 33.3%;
}
div.cover div.box3 {
display: table-cell;
}

「cssにてボタン位置を下揃えしたい」の質問画像

A 回答 (2件)

div.cover { ここに position:relative;を追加



ボタンはpタグで無くdivで囲い、class属性などで
position: absolute; bottom:0; を指定

<p>ボタンA</p> ⇒ <div class="katan">ボタンA</div>



.katan {position: absolute; bottom:0;}
    • good
    • 1
この回答へのお礼

ありがとうございます。

縦位置を揃えることはできました。
が、ボタン位置をセンタリングしたいのですが、
absoluteを使用するとセンタリングできなくなるのでしょうか?

お礼日時:2016/04/09 14:41

>> ボタン位置をセンタリングしたい


1つの例です。

.katan {position: absolute; bottom:0;}

.sita {position: absolute; bottom:0; display:table-cell;
width: 33.3%; text-align:center;}
    • good
    • 0
この回答へのお礼

素晴らし~~!
ありがとうございます!

お礼日時:2016/04/09 15:18

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!