IE7垂直对齐中 - 不工作 [英] IE7 vertically align middle - not working

查看:109
本文介绍了IE7垂直对齐中 - 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请在下面找到链接,



http://jsfiddle.net / anglimass / Y8AvM /



我只是想要我的div来垂直对齐中间ie7也。



有人可以帮忙吗?



感谢



<

对不起,



我找到一个好的解决方案
请参阅下面的链接,



http://jsfiddle.net/anglimass/ct4tx/



感谢,



参考: http://css-tricks.com/snippets/css/exactly-center-an-imagediv-horizo​​ntally-and-vertically/

解决方案

它在IE7中无法正常工作,因为IE7 不支持 display:table-cell



我甚至>



>这是一种在IE7中工作的替代垂直居中技术:
如何以正确垂直对齐图片



这是从上述答案应用于您的代码的最简单的技术版本:http://jsfiddle.net/thirtydot/Y8AvM/1/



HTML:

 < div class =inlay> 
< span class =helper>< / span>< img src =http://goldstudios.net/uploader/uploads/Wildebeest_$1$2ryes3hf$Fl0tEsFaORwBW2seye9qN0.jpg/>
< / div>

CSS: p>

  html,body {
height:100%;
background:#ddd;
}
.inlay {
height:100%;
text-align:center;
}

.inlay img {
vertical-align:middle;
}
.helper {
display:inline-block;
height:100%;
vertical-align:middle;
}

它适用于所有现代浏览器,当然还有IE7。 >

Please find below the link,

http://jsfiddle.net/anglimass/Y8AvM/

I just wanna my div come's vertically align middle ie7 also.

Can anybody help?

Thanks


Sorry guys,

I find out one good solution Please see below the link,

http://jsfiddle.net/anglimass/ct4tx/

Thanks,

Ref:http://css-tricks.com/snippets/css/exactly-center-an-imagediv-horizontally-and-vertically/

解决方案

It's not working in IE7 because IE7 does not support display: table-cell.

I've even told you this before.

Here's an alternative vertical centering technique that does work in IE7: How to properly vertically align an image

Here's the simplest version of the technique from the above answer applied to your code: http://jsfiddle.net/thirtydot/Y8AvM/1/

HTML:

<div class="inlay">
    <span class="helper"></span><img src="http://goldstudios.net/uploader/uploads/Wildebeest_$1$2ryes3hf$Fl0tEsFaORwBW2seye9qN0.jpg" />
</div>​

CSS:

html, body {
    height: 100%;
    background: #ddd;
}
.inlay {
    height: 100%;
    text-align: center;
}

.inlay img {
    vertical-align: middle;
}
.helper {
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}

It works in all modern browsers, and of course, IE7.

这篇关于IE7垂直对齐中 - 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆