Html 垂直对齐在 safari 和 chrome 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17312521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Vertical-align is not working in safari and chrome
提问by Joshua L
<div class="commentator grid_3">
<img src="http://img.gawkerassets.com/img/183mxcnx46v2cjpg/avt-large.jpg" alt="commentator">
<span class="commentator-name"><a href="#">Joshua</a></span>
</div>
So I set commentator-name vertical-align to Top.It works in firefox but not in chrome and safari. Can someone help me out??I dont want to use position absolute when I have a perfect choice...
所以我将 commentator-name vertical-align 设置为 Top。它在 Firefox 中有效,但在 chrome 和 safari 中无效。有人可以帮我吗??当我有一个完美的选择时,我不想使用绝对位置......
回答by Airen
回答by user3231455
Vertical line image with in div works on Chrome and Safari. The code is:
带有 div 的垂直线图像适用于 Chrome 和 Safari。代码是:
<div class="image-wrap">
<img src="xyz.png"/>
</div>
and
和
.image-wrap {
display:table-cell;
width:400px;
vertical-align:middle;
}