CSS在IE或Firefox中不起作用 - Chrome可以正常工作

6

这个网页 http://144.76.221.141:8000 在 Chrome 和 Safari 中展示了正确的 CSS 样式,但在 Firefox 或者 Chrome 中却不能正常显示。我已经看到添加文档类型(doctype)是解决此问题的常见方法,但这对我的问题并没有帮助。如果有任何解决方案的指针,将不胜感激。


CSS,HTML?……Fiddle? - SW4
1
这只是因为不同的浏览器路径渲染方式不同,像Chrome、Safari这样的Webkit浏览器会忽略,但Mozilla不会,所以只需在CSS路径中删除第一个斜杠'/'即可。 - Shivanshu
4个回答

3
您需要将样式表上的type属性设置为以下内容:
<link type="text/css" href="/css/parent.css" rel="stylesheet">
<link type="text/css" href="/css/landing-page.css" rel="stylesheet">
<link type="text/css" href="/css/dropit.css" rel="stylesheet">

去除开头的 /


太简单了,天啊!非常感谢! - scd

2

将样式表声明中的斜杠删除:

<link rel="stylesheet" href="/css/parent.css" type="/text/css" />

为了

<link rel="stylesheet" href="/css/parent.css" type="text/css" />

1
这个声明用于链接你的CSS。
<link href="/css/dropit.css" rel="stylesheet" type="/text/css"></link>

你需要去掉多余的斜杠,type="/text/css" 应该是 type="text/css"
<link href="/css/dropit.css" rel="stylesheet" type="text/css"></link>

0

您可以通过将以下内容添加到样式表中来编写仅适用于IE的CSS。

<!--[if IE 8]>
<style>...</style>
<![endif]-->

如需进一步参考,您可以访问http://www.quirksmode.org/css/condcom.html


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接