Why doenst it apply my IE stylesheet? - css

If you take a look at: http://www.nrgi-raadgivning.dk/erhverv
You can see in the code, that if you are coming from an IE, it should apply a stylesheet...
The IE stylesheet is supposed to set the margin:0 at the dropdown menu ul, but i doesnt?
Any ideas to whats wrong?

From your markup:
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="/Files/System/ie7.css" />
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="/Files/System/ie7.css" />
<![endif]-->
However, the linked URL returns a "File not found message":
http://www.nrgi-raadgivning.dk/Files/System/ie7.css
Also, did you mean to link the same stylesheet twice? If so, you should be able to drop the second conditional comment.

Not found is a simple error irrelevant of the content within the CSS. Make sure your path (/Files/System/ie7.css) is right.

Related

ie8 target style not working

I use this code to set style in ie8 and ie9, and this is not working.
<!--[if lt IE 8,9]>
<link href="~/Styles/ie8-9.css" type="text/css" rel="stylesheet" />
<![endif]-->
but this code worked properly:
<!--[if lt IE 8,9]>
<style>
body{color:red;}
</style>
<![endif]-->
how can I fix the first case?
ADD<!DOCTYPE html> in the top of your html page, it will work if not
Try this:
*::-ms-backdrop, body{color:red !important;}
lt means "less than". What you're looking for is a conditional statement that handles if the browser is equal to IE 8 or IE 9 so you need to do something like the following:
<!--[if IE 8]>
<link href="~/Styles/ie8-9.css" type="text/css" rel="stylesheet" />
<![endif]-->
<!--[if IE 9]>
<link href="~/Styles/ie8-9.css" type="text/css" rel="stylesheet" />
<![endif]-->
I think the problem is that the path to your ie8-9.css is wrong. Check the console for any errors.
Maybe this article is interesting for you:
slash(/) vs tilde slash (~/) in style sheet path in asp.net
Furthermore, instead of
<!--[if lt IE 8,9]>
I suggest you to write
<!--[if (IE 8)|(IE 9)]>
if you want to use the stylesheet only for IE 8 and 9. I'm not sure if the syntax you are using is correct.
Maybe you also reached the maximum of 31 stylesheets per page in IE 8 and 9.
Don't test with such tools like IETester because they are not 100% equal to the real browsers. Go to modern.ie and download a virtual machine to test your site.
Other ressources:
https://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx
http://de.wikipedia.org/wiki/Conditional_Comments
http://css-tricks.com/how-to-create-an-ie-only-stylesheet/

Unable to load CSS with Internet Explorer Conditional Comment

The file contains only a color of green for the text. When I run the page, text remains black. If I move the "link rel..." outside of the comment block it will then load text as green.
<!--[if IE ]>
<link rel="stylesheet" type="text/css" href="_css/ie_only.css"/>
<![endif]-->
How is this to be written in order for it to load only for Internet Explorer?
Unless its a folder name...Remove _ from href and space after IE!!!
<!--[if IE]>
^^ space was here
<link rel="stylesheet" type="text/css" href="css/ie_only.css" />
<![endif]-->
Remove the trailing space after IE
The issue is that I have IE 10 and as 'Alexander' has pointed out it does not support conditional comments. Thank you everyone.

Force IE to ignore other css style sheets

I have nearly finished the site i am working on, however IE doesn't accept some of my animations.
I know i can specify a IE only sheet:
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="path/to/stylesheet.css"></link>
<![endif]-->
However IE still runs the other style sheet, Does anyone know a way to force IE to ignore a css style sheet?
regards,
Jimy
Since CSS stands for cascading style sheet the idea for these conditional sheets is to override the "normal css"
<link rel="stylesheet" type="text/css" href="path/to/normalstylesheet.css"></link>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="path/to/iestylesheet.css"></link>
<!--[endif]-->
Everything in the former would be over wrote by the latter stylesheet. If you have another specific reason to omit something though you can always use this.
<!--[if !IE]-->
<link rel="stylesheet" type="text/css" href="path/to/notiestylesheet.css"></link>
<!--[endif]-->
You can use this,
<!--[if !IE]-->
IE ignores this
<!--[endif]-->

Conditional Sylesheets Rails 3.1

I am in the process of cross browser testing my site and of course IE is giving me the biggest headache. I know I have to use conditional style sheets but am unsure of where to put these in rails so they are rendered only if IE7 or IE8 for example. I have seen a example on stack overflow but he seems to be using HAML whereas I am not.
Has anyone encountered this issue before and if so what did you do.
Thanks
Assuming you're using the asset pipeline, the only solution I've found for this so far is to not include your stylesheets so that they get compiled into the one file, but instead just include your IE stylesheet(s) separately in the head tag of your layout file as you normally would.
<head>
<!--[if IE 7]>
<link href="ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if IE 8]>
<link href="ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>

Conditional comments for IE, are also visible to Firefox

What's the matter with my conditional comments? They apply both to firefox and IE!
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="../App_Themes/css/stylesIE7.css" />
<![endif]-->
Is this normal? Am I missing something?
If by "visible" you mean they are visible in the source code, that is as designed. But Firefox will not be loading the CSS file, but treat the whole section as a comment. The syntax you use is correct.
Use e.g. Firebug's "Net" tab to confirm that the style sheet is in fact not being loaded.
In the source I see that you're including the stylesheets twice. Remove the last one.
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="App_Themes/trimar/stylesIE7.css" />
<![endif]-->
<link href="App_Themes/trimar/styles.css" type="text/css" rel="stylesheet" />
<link href="App_Themes/trimar/stylesIE7.css" type="text/css" rel="stylesheet" />

Resources