下記のようにポジションfixedでdivを中央に表示させ、その中のimgも中央に表示させるライトボックスを作ったのですが、
なぜかimgが左上ぞろいになってしまいます。
fixedをかけたボックスの中の、imgなどの要素は、中央ぞろえができないのでしょうか?
<!-- lightbox-images --><article id="lightbox-course"> <div id="lightbox-tutor1"><img src="./img/index/pcimage.png" alt="iphone" class="close"></div> <div id="lightbox-tutor2"><img src="./img/index/tabletimage.png" alt="webservice" class="close"></div> <div id="lightbox-tutor3"><img src="./img/index/spimage-top.png" alt="robot" class="close"></div> <div id="lightbox-tutor4"><img src="./img/index/spimage-center.png" alt="robot" class="close"></div> </article>
#lightbox-course div {
display: none;
position:fixed;
z-index:2;
width: 90%;
top: 0;
bottom: 0;
left: 0;
right: 0;
text-align: center;
vertical-align: middle;
margin: auto;
cursor: pointer;
background-color: #fff;
}
#lightbox-course img.close {
vertical-align: middle;
text-align: center;
background-color: #fff;
}
上記CSSは#lightbox-course img.closeとシャープがついているのですが、なぜか表記上はないことになってしまっています。
CSSは間違いなくあったっているのですが、上下真ん中になりません。
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/01/13 07:08
退会済みユーザー
2016/01/13 07:16
2016/01/13 08:21
退会済みユーザー
2016/01/13 08:55
退会済みユーザー
2016/01/13 09:07
2016/01/13 09:45
退会済みユーザー
2016/01/14 10:52