Phone and FAX
Tel: 0845 121 1194
Fax: 0845 121 1195
Archives:
Meta:
Categories:
Displaying HTML for Internet Explorer only - September 18, 2008
There are many reasons why you would want to display pieces of code differently in IE. Im sure you know what I mean…
As most web designers will know, IE is not the the best to work with as it renders HTML slightly differently. There are many ways to work round this issue and this is one of them:
<code><!–[if IE]>
<i>Anything here will be displayed in Internet Explorer ONLY</i>
<![endif]—-></code>
The above code, when placed in your HTML code, will only show if using any version of Internet Explorer.
<code><!–[if !IE]–>
<i>Anything here will be displayed in any browser, other than Internet Explorer</i>
<!–[endif]–></code>
Like a lot of the major programming languages, have an exclamation mark indicates NOT.
<code><!–[if IE 6]>
<i>All code here will only show in IE6</i>
<![endif]—-></code>
The above will only view in IE6 - The most used browser at the time of writingg this. This code is very much needed.
You can also use the ‘!’ and change 6 to 5 and 7 (Maybe 8 also?) for the various versions of IE.
<code><!–[if gt IE 5]>
<i>Only viewable be browsers greater than IE5</i>
<![endif]—-></code>
As you would have guessed, gt stands for “Greater Than”. gt could be replaced by the following also:
lt - is less than
lte - is less than or equal to
gte - is greater than or equal to
bhulaa at 2:51 pm
No Comments
No comments yet.