Modernizr:我如何检测CSS显示:table-cell支持? [英] Modernizr: how do I detect CSS display:table-cell support?

查看:108
本文介绍了Modernizr:我如何检测CSS显示:table-cell支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在支持它的浏览器中使用 display:table display:table-cell 。在IE7我只想浮动我的列(因为我认为它不可能让它在该浏览器中工作,但不能找到任何关于如何使用Modernizr做它。任何人可以帮助我吗?

I want to use display: table and display: table-cell for my layout in browsers that support it. In IE7 I simply want to float my columns (since I assume it's not possible to get it to work in that browser), but cannot find anything about how to do it using Modernizr. Can anyone help me please?

我想我可以使用一个浏览器条件,但希望不必打破另一个CSS文件。

I suppose I could use a browser conditional, but was hoping to not have to break out another CSS file.

谢谢!

推荐答案

如果所有你想做的是为IE7和更少应用一个不同的规则,

If all you want to do is apply a single different rule for IE7 and less, I'd be tempted not to use Modernizr for this specific job.

只需这样做,以避免打破另一个CSS文件

Simply do something like this, to avoid having to "break out another CSS file":

#menu li {
    display: table-cell;
    *float: left;
}

这使用

This uses the Star Property Hack to provide a rule to only IE7 and below.

另一个选项是 http://stackoverflow.com/questions/4987418/bang-ie7-what-does-it-mean/4987481#4987481> !ie7 hack ,这是出于某种奇怪的原因我最高的投票答案。

Another option is the !ie7 hack, which is for some odd reason my highest voted answer.

这篇关于Modernizr:我如何检测CSS显示:table-cell支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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