IE7和CSS table-cell属性 [英] IE7 and the CSS table-cell property

查看:157
本文介绍了IE7和CSS table-cell属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我只是喜欢它,当我的应用程序在Firefox工作很好,但然后我在IE和...打开它...不,请重试。

So I just love it when my application is working great in Firefox, but then I open it in IE and... Nope, please try again.

问题我有设置一个CSS显示属性为 table-cell 与JavaScript 。

The issue I'm having is that I'm setting a CSS display property to either none or table-cell with JavaScript.

我最初使用的是 display:block ,但是Firefox没有 table-cell 属性。

I was initially using display: block, but Firefox was rendering it weird without the table-cell property.

我希望这样做而不用在JavaScript中添加一个黑客来测试IE。任何建议?

I would love to do this without adding a hack in the JavaScript to test for IE. Any suggestions?

感谢。

推荐答案

这将显示值设置为''

<script type="text/javascript">
<!--
function toggle( elemntId ) {
    if (document.getElementById( elemntId ).style.display != 'none') {
        document.getElementById( elemntId ).style.display = 'none';
    } else {
        document.getElementById( elemntId ).style.display = '';
    }
    return true;
}
//-->
</script>

空值会使样式恢复为其默认值。此解决方案适用于所有主要浏览器。

The empty value causes the style to revert back to it's default value. This solution works across all major browsers.

这篇关于IE7和CSS table-cell属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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