FastTrack FastTrack - 1 year ago 92
CSS Question

Apply style ONLY on IE

Here is my block of 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;

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

What is the simplest way to accomplish this?

Answer Source

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

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

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download