imgを上下中央ぞろえにしたいのですが、なりません
https://teratail.com/questions/24542の続き。
<article id="lightbox-course"> <div id="lightbox-tutor1"> <div class="lightbox-course__inner"><img src="./img/index/pcimage.png" alt="iphone" class="close"> </div> </div> </article>
#lightbox-course > div { display: none; position:fixed; z-index:2; width: 40%; top: 0; bottom: 0; left: 0; right: 0; text-align: center; vertical-align: middle; margin: auto; cursor: pointer; /* background-color: #fff;*/ } .lightbox-course__inner { display: table; } #lightbox-course img.close { display: table-cell; vertical-align: middle; }
下記のように、trになる部分がないと中央ぞろえに出来ないのでしょうか?
それともimgタグはインライン要素なので、display: table-cell;をつけても効かない仕様なのでしょうか?
.tr { display:table-row; }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/01/16 09:39