仅在IE上应用样式 [英] Apply style ONLY on IE

查看:95
本文介绍了仅在IE上应用样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是我的CSS块:

.actual-form table {
  padding: 5px 0 15px 15px;
  margin: 0 0 30px 0;
  display: block;
  width: 100%;
  background: #f9f9f9;
  border-top: 1px solid #d0d0d0;
  border-bottom: 1px solid #d0d0d0;
}

我只希望IE 7,8和9看到 width:100%

I only want IE 7, 8, and 9 to "see" width: 100%

这是最简单的方法是什么?

What is the simplest way to accomplish this?

推荐答案

最简单的方法是使用

The simplest way is probably to use an Internet Explorer conditional comment in your HTML:

<!--[if IE]>
<style>
    .actual-form table {
         width: 100%;
    }
</style>
<![endif]-->

有许多骇客(例如 underscore hack ),你可以使用它将允许你只在你的样式表中定位IE,但是如果你想定位所有平台上的所有版本的IE。

There are numerous hacks (e.g. the underscore hack) you can use that will allow you to target only IE within your stylesheet, but it gets very messy if you want to target all versions of IE on all platforms.

这篇关于仅在IE上应用样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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