IE conditional comment not working [closed] - css

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I'm having a bit of a problem with the conditional comment for IE.
<link rel = "stylesheet"
type = "text/css"
href = "css/stil.css" />
<!--[if IE]>
<link rel = "stylesheet"
type = "text/css"
href = "css/ie.css" />
<![endif]-->
It's not working in IE9, IE9 loads the normal stylesheet (css/stil.css) and not the one i specify in the conditional comment. Please help :)

IE9 loads the normal stylesheet (css/stil.css) and not the one i specify in the conditional comment.
From that sentence, it sounds like you're not expecting IE to download and apply the css/stil.css stylesheet. It should and will. It's just that it should also download and apply the css/ie.css stylesheet. Could it be that you're seeing styles from css/stil.css that you aren't expecting? On the face of it, the conditional comments work fine (I had to use style rather than link elements in that example, but the concept is the same).

Related

HTML5 Doesn't allow linking external stylesheets? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I was having issues using <link rel="stylesheet" href="styles.css">
on my webpage. It's in the head tag. Once I removed the HTML5 doctype declaration, it worked fine, no other changes... Any ideas as to why HTML5 would be preventing the browser from using the external stylesheet?
First, make sure you actually have a styles.css file in the same directory as your HTML5 document. Second, try this code, instead: <link href="styles.css" rel="stylesheet" type="text/css">.
The odds are that this has nothing to do with the style sheet being external as opposite to being embedded in HTML via the style element. Rather, some parts of the style sheet itself “work” in quirks mode only, and <!doctype html> prevents quirks mode.
For example, a declaration like width: 600 ignored by conforming browsers, by CSS rules. In quirks mode, browsers intentionally break the rules and interpret 600 as 600px, which is usually what the author meant.
The conclusions depend mainly on the status of the page. If it is an old page, it may have many kinds of quirks that require quirks mode; then just don’t add <!doctype html>. If it is a new page, or a page being completely rewritten, get rid of quirks: make sure your HTML, CSS, and JavaScript code conform to specifications.
This markup is fine:
<link rel="stylesheet" href="styles.css">
The type=text/css is not required, it's used by user agents only.
The problem must be in your browser - clear cookies/cache /test with a different browser.
(you may check out this demo: <link> tag, 2 examples + interpretation - removing step by step each attribute to highlight the impact in Browser if any)

CSS Conditional comments not working(Updated To: IE specific css?)

I have been trying to get the CSS conditional comments working on MVC.(Conditional Comment below). I have been looking for the answer on google but they all seem to have the same code but working. But It doesn't seem to work for mine. Is there a problem in the code? It seems as thought it takes it as a comment. Does it not work for MVC Razor? Does it have anything to do with IE versions? If this question was already please feel free to link it for me! (Look at update)
<!--[if IE]>
<link rel="stylesheet" href="~/Content/BrowseStyle2.css" />
<![endif]-->
UPDATE
Conditional comments are not supported in IE 10. Is there another way to get IE specific Css files working or IE specific CSS classes?
It's the "~". I had the same issue. For some reason it's not being rendered on the server side, I guess since it's wrapped in IE conditional comments. You have two options:
Use the full URL of the file
Or do something like
<link rel="stylesheet" href="#Url.Content("~/Content/BrowseStyle2.css")" />
I hope that helps.
What's the "~" doing in the path to the CSS File?

CSS Issue with IE7 and IE8 [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I am stuck in Template designing for IE7 and IE8. I cannot bring the result what is intended. For all major browsers, the template looks good and as intended, but there is an issue with IE7 and IE8. I have tested it for all major browsers using http://www.browserstack.com/. The template path is : http://www.directfurnitureplace.co.uk/fofeed/Template1.html.
I have tried reducing the font size which solves problem, but I don't want the font size reduced as it displays very small in other browsers (i.e FireFox, Opera, Chrome etc).
I want the in question template to display in IE7 and IE8 as it displays in FireFox and Chrome.
Your help in this regard will be highly appreciated.
Thanks
Use conditional stylesheets.
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="ie.css" />
<![endif]-->
Reference

Aria Templates browser compatibility [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I tried to run a simple code using Aria Templates. In mozilla it is working fine. In chrome, I am facing "Origin null is not allowed by Access-Control-Allow-Origin" and IE7 is not displaying anything and at the same time not throwing any error(that we usually see in footer).
Here is the code:index.html:
<html>
<head>
<title>
Aria Templates
</title>
<script type="text/javascript" src="aria/ariatemplates-1.3.6.js"></script>
<script type="text/javascript" src="aria/css/atskin-1.3.6.js"></script>
</head>
<body>
<div id="output"></div>
<script type="text/javascript">
Aria.loadTemplate({
classpath: 'view.Hello',
div: "output",
data: {
greeting: "Hello",
people: ["John", "Paul", "George", "Ringo"]
}
});
</script>
</body>
</html>
and Hello.tpl:
{Template {
$classpath: "view.Hello"
}}
{macro main()}
<h1>Hello Fab Four World</h1>
{foreach name in data.people}
${data.greeting} ${name}!<br/>
{/foreach}
{/macro}
{/Template}
The files are in same drive. Hello.tpl is placed inside view folder and html file is placed outside view along with aria folder.
Due cross domain issue the Aria Template JS doesn't load locally. Use some server which can give you option to run code from server
You can use Mongoose Server https://code.google.com/p/mongoose/

CSS disappears when I add a doctype [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
When I add a doctype to my site, my CSS fails to load. It works fine when there is no doctype.
This is my doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
My CSS location is here:
www.site.com/static/css/main.css
Defined like this:
<link href="/static/css/main.css" rel="stylesheet" type="text/css" />
I did some googling, but my site pretty much validates, so I cant understand why the entire CSS would refuse to show completely!
Here is a URL: LIVE SITE
I am using latest Google Chrome
[21:51:53.698] The stylesheet /static/css/main.css was not loaded
because its MIME type, "text/plain", is not "text/css".
You need to make sure the mime type is text/css.

Resources