基于浏览器应用不同的CSS宽度属性? (IE8,FF) [英] Apply a different CSS width property based on browser? (IE8, FF)

查看:104
本文介绍了基于浏览器应用不同的CSS宽度属性? (IE8,FF)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将宽度应用于div。宽度值需要在浏览器中变化。我不能应用条件css。

I have to apply width to a div. The width value is need to be varied across browser. I cant apply conditional css . So can there be any hack for doing this.

FF

.apply{
    width: 720px; 
}

IE8

.apply{
    width: 690px; 
}

可以使用一些hack来组合这些,以便自动应用相应的属性

Can these be combined using some hack so that the respective properties will be applied automaticaly as per the browser.

推荐答案

对于Firefox和IE:

For Firefox and IE specifically:

在CSS中:

@-moz-document url-prefix() {
    //Firefox-specific CSS here.
}

在HTML中:

<!--[if IE 8]>
    <style type="text/css">
        //IE8-specific CSS here.
    </style>
<![endif]-->

这篇关于基于浏览器应用不同的CSS宽度属性? (IE8,FF)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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