Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-28-2006, 08:41 PM   PM User | #1
graficus
New Coder

 
Join Date: Aug 2006
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
graficus is an unknown quantity at this point
Browser dependent stylesheet

Internet Explorer keeps mucking up all the neat CSS that works fine in Firefox and Opera.
Could someone suggest a script that would do something like this:

Code:
if browser IE then
response.write
<link rel="stylesheet" type="text/css" href="IE.css">
else 
response.write
<link rel="stylesheet" type="text/css" href="normal.css">
ASP only please, no javascript
Thank you in advance!
__________________
I know that I know nothing
graficus is offline   Reply With Quote
Old 09-28-2006, 08:50 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,451
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
IE provides a way to do it in HTML, no scripting of any sort required.

Code:
<link rel="stylesheet" type="text/css" href="normal.css">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="IE.css">
<![endif]-->
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 09-28-2006, 09:19 PM   PM User | #3
graficus
New Coder

 
Join Date: Aug 2006
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
graficus is an unknown quantity at this point
Fantastic! And I thought I knew all the HTML there is to know

Thanks!
__________________
I know that I know nothing
graficus is offline   Reply With Quote
Old 09-28-2006, 11:11 PM   PM User | #4
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,451
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
It is an IE proprietary way of adding conditional statements into HTML. All other browsers just treat it as comments.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 09-28-2006, 11:28 PM   PM User | #5
graficus
New Coder

 
Join Date: Aug 2006
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
graficus is an unknown quantity at this point
Are there any other "proprietary" tricks out there?
__________________
I know that I know nothing
graficus is offline   Reply With Quote
Old 09-29-2006, 12:19 AM   PM User | #6
quackor
New to the CF scene

 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
quackor is an unknown quantity at this point
Here's what I use to deal with the dreaded 3px bug in IE

#somecss {
margin-left = 0px;
}

*html #somecss {
margin-left = -3px;
}

Every browser but IE will use "#somecss" style properties, but IE will use the ones from "*html #somecss"
quackor is offline   Reply With Quote
Old 09-29-2006, 02:32 AM   PM User | #7
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,451
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Using two separate stylesheets and IE conditionals in the HTML you don't need to use hacks like that, you just put the IE code in the IE stylesheet to override the standard code.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:42 AM.


Advertisement
Log in to turn off these ads.