Enter a query to search our site. Note that you can use "*" and "?" as wildcards. Enclosing more than one word in double quotes ("CSS Layout") will search for the exact phrase.

Project Seven dot com

PVII PowerToys

Add to Cart - $18

IE Conditional Comment PowerToy

IE Conditional Comments are a Microsoft feature built into MS Internet Explorer versions 5.0 and higher on Windows operating systems. They allow you to include code targeted at browser specific versions. Using this technique to serve curative style rules to Internet Explorer allows your main style sheet to remain clean and devoid of hacks.

The IE Conditional comment contains syntax similar to a normal html comment (<!-- ... -->) and a conditional filter that describes which version of IE should read the code inside of the filter. The filter consists of an if or other conditional logic statement that checks the version vector enclosed within brackets. The version vector describes the version, or multiple versions, of IE to be targeted.

This IE filter, <!--[if IE 5]>, targets all versions of Internet Explorer from 5.0-5.99, but not version 6.0 and higher.

This IE filter, < !--[if gte IE 5.5]>, targets all versions of Internet Explorer from 5.50 and higher, including version 6 (gte means greater than or equal to).

The Insert IE Conditional Comment Tag PowerToy allows you to quickly insert a pair of IE Conditional comment tags anywhere in your code. You can also apply the IE conditional comment tags to any selected portion of your code. Right-click (control-click on the Mac) and select Insert IE Conditional Comment Tag from the context menu, then select the type of filter you wish to apply. The IE Conditional comment tag pair will automatically wrap around any code that you have selected.

Note: The Insert IE Conditional Comment Tag PowerToy will only be available when you are in Code View, it will not be listed on the context menu when you are in Design View.

The Insert Insert IE Conditional Comment Tag PowerToy allows you to select from six pre-defined filter types:

The IE Conditional Comments menu flyout

  1. All IE 5.x versions, IE 5.0 to 5.99: [if IE 5]
  2. Only IE 5.5 versions, IE 5.50 to 5.59: [if IE 5.5]
  3. Only IE 6.x versions, IE6.0 to IE6.99 : [if IE 6]
  4. All version of IE greater than or equal to version 5.0: [if gte IE 5]
  5. All version of IE greater than or equal to version 5.5: [if gte IE 5.5]
  6. All version of IE less than or equal to version 6.0: [if lte IE 6]

Creating an empty set of IE Conditional comment tags

-In code view, click on the section of the page where you would like to create the new IE Conditional comment tag, this is the insertion point. You would normally do this on a blank line.

-Right-click and select PVII PowerToys - Insert IE Conditional Comment Tag

-From the menu flyout, select the type of comment tag you wish to use. In this example we'll use the all IE 5.x version filter

Selecting the IE 5 filter

A new pair of IE Conditional comment tags will be added to the page at the insertion point. Your cursor will be positioned inside the newly created comment tag, ready for you to enter any desired content.

Newly added IE 5 filter comment

NOTE: Conditional Comments can contain any content, not just style or script fixes. For instance, you can insert a conditional comment within the body area that contains a message for users of a targeted IE version - such as, <p>"Hello, I see you are using IE5.5".</p>

Wrapping existing code with a pair of IE Conditional comment tags

-In code view, select the code or markup you wish to wrap with the comment tag. We'll use an embedded style sheet for this example.

Selected style tag markup

-Right-click and select PVII PowerToys - Insert IE Conditional Comment Tag - [if IE 5]

Choosing the IE5 conditional filter option

A new pair of IE Conditional comment tags will be wrapped around the selected code. The entire construct, including the newly added pair of comment tags, will remain selected. Click anywhere else on the page to deselect it.

IE 5 filter block containing style sheet rules

User Notes

Use Care -This PowerToy will wrap or insert the selected comment tag at your current insertion point, wherever it is located. Be sure that the location will make sense to your code or html markup. The IE Conditional Comment syntax is designed to be used in html markup only, never place this inside of a <style> tag or in an external style sheet; it must be placed within the normal html markup on your page.

Undo -You can reverse the PowerToy insertion by using the Dreamweaver Undo feature (Select: Edit - Undo). This will restore your markup to the state prior to the PowerToy insertion.

Add to Cart - $18

See More PowerToys Features