向 IE 发送特定样式表时遇到问题
无论我做什么,IE都不会显示我的网站。我不确定我做错了什么以及如何解决这个问题。如果有人可以帮忙,请。我已经被这个问题困扰了好几天了,
我正在创建我的第一个 HTML5 网站,当然,在新领域,还有更多东西需要学习。 我的网站在我所知的所有浏览器和设备上运行良好当屏幕处于特定尺寸时,我使用 CSS3 媒体查询发送我想要的信息。
当然,现在 IE 不支持此功能,因此我使用条件注释来查看它是否是 IE,以及是否使用我的 ie.css 样式。然而,我必须把它放在错误的位置,因为它要么不起作用(页面上没有显示任何内容,然后崩溃),要么它在全尺寸窗口上显示移动样式!我尝试使用 respond.js 文件和 css3-mediaqueries.js 文件,但它们对我不起作用。这是阻止我建立这个网站的最后一件事,在苦苦思索为什么它不起作用之后,我迫切希望找到解决方案。
这是我头的底部。
<link rel="stylesheet" href="css/style-fluid.css" />
<!--[if IE]>
<link rel="stylesheet" href="css/ie.css" />
<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" href="css/ie.css" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" href="css/ie.css" />
<![endif]-->
<script src="js/libs/modernizr-2.0.6.min.js"></script>
</head>
所以我不确定我做错了什么会发生这种情况。我想使用媒体查询有一段时间了,我知道有一种方法可以使用它们,只需告诉 IE 使用此样式表即可?
任何帮助表示赞赏。
No matter what I do, IE will not display my website. I'm not sure what I'm doing wrong and how I can go about fixing this. If anyone can help, please. I have been stumped on this for days
I am creating my first HTML5 website and of course with a the new territory there is more to learn. My website here works well in all browsers and devices that I know of so far and I'm using CSS3 media queries to send the information I want when the screen is at specific size.
Now of course IE doesn't support this feature so I'm using conditional comments to see if it is IE and if it is use my ie.css styles. However I have to be laying it our wrong cause it's either not working (nothing shows up on the page and then crashes) or it shows the mobile styles on the full size window! I have tried to use the respond.js file AND the css3-mediaqueries.js file and they have not worked for me. This is the last thing in my way stopping me from getting this site up and after struggling with why it does not work I'm getting desperate to find a solution.
This is the bottom part of my head.
<link rel="stylesheet" href="css/style-fluid.css" />
<!--[if IE]>
<link rel="stylesheet" href="css/ie.css" />
<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" href="css/ie.css" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" href="css/ie.css" />
<![endif]-->
<script src="js/libs/modernizr-2.0.6.min.js"></script>
</head>
So I'm not sure what I a m doing wrong to have this happen. I've wanted to use media queries for a while now and I know there is a way to use them and just tell IE to use this style sheet instead?
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
起初我认为它是你的头顶......当你声明时你有这个奇怪的评论标记,我认为我造成了问题,并且没有正确渲染你以后的 IF IE。改变
至
但我一直在不同的服务器上测试它,这似乎并没有打扰它。
您会认为正在运行的服务器有问题吗?看来你尝试了很多东西..
尝试我的第一个建议,然后查看 http://tinyurl.com/87maskt< /a> 在 ie 中而不是 ie..
[我只是从这里的来源和参考中进行了c&p。如果您愿意,可以向我发送实际的首页代码以进行测试。]
祝您好运!
at first i though its the top of you head... when you declate you have this strange commenting markup, which i think i causing problems, and not rendering your later IF IE properly. change
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
to<!--[if gt IE 8]> <html class="no-js" lang="en"> <![endif]-->
but i've been testing it out on a different server and that doesnt seem to bother it.
would you consider the server this is being run on as the issue? it seems like you tried quite a few things..
try my first suggestion, and check out http://tinyurl.com/87maskt in ie and not ie..
[i just c&p from the source and the reference here. if you want you can send me the actual front page code to test there.]
best of luck!
我认为问题的存在是因为你的 css 给定类型中没有位置。您应该将类型设置为
text/css
I think the issue is there because you have no where in your css given type. You should have set the type as
text/css
我认为问题不在于样式表..这是你的html标签...
我可以问为什么吗???这实在是没有必要。
I think the problem is not the stylesheets.. it's your html tag...
Can I ask why???? That's really unnecessary.
试试这个:
Try this:
我想我明白了。从 ie.css 中删除 @media print 部分。
Think I got it. Remove the @media print section from your ie.css.
您可以执行以下操作:
如果respond.js 有效,您将无需担心 IE 样式表,并且可以完全避免它。
现在最关键的是:您的 IE 样式表中包含 HTML5 样板重置。你需要摆脱这个。您应该在 IE 特定样式表中包含的唯一内容是您想要对文本大小等进行的细微调整。
但希望如果 respond.js 支持您的媒体查询,您根本不需要使用此 IE 特定样式表。我会尝试删除 IE 特定样式表并实施 respond.js 来解决您的问题。
There are a few things you could do:
If respond.js works you won't need to worry about your IE stylesheet and you can avoid it all together.
Now here's the kicker: your IE stylesheet has the HTML5 boilerplate reset included in it. You need to get rid of this. The only thing you should include in your IE specific stylesheet are the minor adjustments you want to make with text sizes, etc.
BUT hopefully you won't need to use this IE specific stylesheet at all if respond.js supports your media queries. I'd try removing the IE specific stylesheet and implementing respond.js to solve your issues.
删除最后一个 if 语句中的注释,并更改前 7 个 if 语句 6 以及删除 8 的双 if 语句
Remove the comment from your last if statement and change the first 7 if statement too 6 as well as remove the double if statements for 8
尝试将
标记中的
class=
属性移动到标记中,并更改
css 针对
进行选择
Try moving the
class=
attribute in the<html>
tag into the<body>
tag and changing thecss
to select against the<body>
只是一个想法...为什么不使用 Javascript 来查明他们是否正在使用 Internet Explorer,如果是,则将他们重定向到另一个导入 ie.css 的主页:
index.php
ie.php
问题解决了!希望这有帮助!
Just a thought...Why don't you use Javascript to find out if they are using Internet Explorer, and if they are, redirect them to another home page that imports ie.css:
index.php
ie.php
Problem solved! Hope this helps!