html - 为什么 Firefox 不会在没有错误消息的情况下启动 Css?

标签 html css debugging firefox

我在记事本上为一个带有 css 的 html 站点编写了这个示例代码,但这在 Mozilla(版本 49.0.etc)上不起作用,而在 IE、Chrome 和 Opera 上却起作用。如果我在 FF 上启动它,调试器会说“CSS 没有错误”,但它只显示 html 代码。 有人知道如何解决吗?

这里有我的站点在本地路径上的代码(html 和 CSS):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   http://www.w3.org/TR/html4/loose.dtd>
    <html lang="it">
    <head>
    <meta name="viewport" content="width=device-width">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" charset="iso-8859-1">

        <title>Site</title>

    <style type="text/css">
    </style>
    <link href="C:/Users/Dean/Desktop/Site/File/file1.css" rel="stylesheet" media="all">


</head>



<body class="sub">
<div class="alt">


<h1>Text here</h1>

</div>
    </body>
    </html>

这里有 CSS 文件属性:

.sub{background-image:url("../image/bg.jpg");
    background-repeat:no-repeat;
    background-size:100% 100%;
    background-attachment:fixed;

}


.alt {background-color:hotpink;
    box-align:right;
    border-radius:10px;
    }

.set {font-size:12px;
    color:white;
    }

最佳答案

我假设这是因为您的样式表是通过非标准 file 协议(protocol)链接的(href="C:/Users/Dean/Desktop/Site/File/file1.css ")。根据我的经验,Firefox 通常比其他浏览器更符合标准。

假设这就是为什么您的示例在其他浏览器中有效,但在 FF 中无效的原因。尝试使用 HTTP 服务器提供您的样式表。

关于html - 为什么 Firefox 不会在没有错误消息的情况下启动 Css?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40298117/

相关文章:

javascript - 如何为一个简单的 donut 为 SVG Circle 的笔触添加边距

javascript - 检查 innerHTML 是否超过父级的宽度或高度

html - h3 Bootstrap(Ionicons)上方的中心图标

css - Drupal 7 Blocks 不考虑重量

iphone - 如何弄清楚模拟器中的 `call stack` 含义?

php - html5 视频播放器的视频格式

html - 有没有办法在不使用 z-index 的情况下阻止我的图像与标题/导航栏重叠(这似乎不起作用?)

css - 在列表中叠加图像

node.js - 为什么 Protractor 调试器范围内没有任何内容?

c# - NullReferenceException,没有堆栈跟踪...从哪里开始?