londesbb Posted June 23, 2006 Share Posted June 23, 2006 I'm having trouble coding any kind of if statement to load the code appropriately. You can view the website at http://www.londes.com/aa . If you are running IE it will not look right, if you are running Firefox or something else it should be fine. What I want to do is load a different page if the user is running IE.Please let me know how I can do this if possible. Link to comment Share on other sites More sharing options...
aspnetguy Posted June 23, 2006 Share Posted June 23, 2006 conditional comments should do the trickhttp://msdn.microsoft.com/workshop/author/...comment_ovw.asp Link to comment Share on other sites More sharing options...
londesbb Posted June 23, 2006 Author Share Posted June 23, 2006 It doesn't look like that supports ways of loading Firefox, as for some reason the ! operator isn't doing anything.I tried this and it didn't work:<style><!--[if IE]><link REL="STYLESHEET" TYPE="text/css" HREF="/ie.css" Title="TOCStyle"><![endif]--><![if !IE]><link REL="STYLESHEET" TYPE="text/css" HREF="/firefox.css" Title="TOCStyle"><![endif]></style>Also tried this which did not work:<!--[if IE]><STYLE TYPE="text/css"> @import url("ie.css") </STYLE><![endif]--><![if !IE]><STYLE TYPE="text/css"> @import url("firefox.css") </STYLE><![endif]> Link to comment Share on other sites More sharing options...
londesbb Posted June 23, 2006 Author Share Posted June 23, 2006 I got that to work, so now how should the css import statements look? Link to comment Share on other sites More sharing options...
aspnetguy Posted June 23, 2006 Share Posted June 23, 2006 What you need to do is load the firefox stylesheet first then use the conditional comments to load your IE only stylesheet which only contains css code meant for IE. <link type="text/css" rel="stylesheet" href="common.css"/><!--[if IE]><link type="text/css" rel="stylesheet" href="ieonly.css"/><![endif]--> Link to comment Share on other sites More sharing options...
londesbb Posted June 23, 2006 Author Share Posted June 23, 2006 Nevermind... *scratches head* I always fix it right after I post Link to comment Share on other sites More sharing options...
boen_robot Posted June 23, 2006 Share Posted June 23, 2006 By the way, here's a hint. You can load special styles for all browsers, including IE, and then load other styles for everyone, except IE. Here's tre trick: <link type="text/css" rel="stylesheet" href="commonStyles.css"/><!--[if IE]><comment><![endif]--><link type="text/css" rel="stylesheet" href="nonIEstyles.css"/><!--[if IE]></comment><![endif]--> The key is in the non standart <comment> tag supported only by IE. Because the second stylesheet is suppose to be enclosed in it, IE should (I haven't tested this) ignore the stylesheet inside. The best thing about this method is that it validates, scince everything in comments is ignored by the validator. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now