如何编写IE 8的具体css样式 [英] how to write IE 8 specific css styles

查看:158
本文介绍了如何编写IE 8的具体css样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能为少数元素编写IE 8特定样式而不使用js或jquery?
我有一个要求,其中使用line-height,这工作正常firefox和chrome在IE8我想减少2 px的行高可以在风格类中做这个?

Is it possible to write IE 8 specific styles for few elements without using js or jquery? I have a requirement in which line-height is used , this works fine firefox and chrome where as in IE8 i want to reduce 2 px of line-height can i do this in style class ?

推荐答案

是的,您可以使用Paul-Irish定位IE浏览器的方式:



Yes, you can use Paul-Irish's way of targetting IE Browsers:

<!--[if lt IE 7]>  <html class="ie ie6 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 7]>     <html class="ie ie7 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 8]>     <html class="ie ie8 lte9 lte8"> <![endif]-->
<!--[if IE 9]>     <html class="ie ie9 lte9"> <![endif]-->
<!--[if gt IE 9]>  <html> <![endif]-->
<!--[if !IE]><!--> <html>             <!--<![endif]-->



或新的:



Or the new one:

<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->



因此,只需要定位IE 8,就可以使用:



So for just targetting IE 8, you can use:

<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->

这篇关于如何编写IE 8的具体css样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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