html - 声明 <!DOCTYPE html> 后网页无法加载 css 文件

标签 html css

我正在使用 JSP 创建网页。我已将 css 文件链接到带有 <link rel="stylesheet" href="css/style_mobile.css" type="text/css"> 的 jsp 页面,这是文件的确切路径。

谷歌浏览器的检查:

enter image description here

<head>的内容我的 .jsp 文件中的标记:

<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

<!-- Sets initial viewport load and disables zooming  -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">

<!-- Makes your prototype chrome-less once bookmarked to your phone's home screen -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="mobile-web-app-capable" content="yes">

<!-- Include the compiled Ratchet CSS -->
<link rel="stylesheet" href="css/ratchet.css" type="text/css">
<link rel="stylesheet" href="css/style_mobile.css" type="text/css">
<link rel="stylesheet" href="css/tablesaw.css" type="text/css">

<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/fusioncharts-suite-xt/js/fusioncharts.js"></script>
<script type="text/javascript" src="js/tablesaw.js"></script>
<script type="text/javascript" src="js/tablesaw-init.js"></script>

<title>Mobile</title>
</head>

CSS 文件:

ratches.css

style_mobile.css

tablesaw.css

网页只是不加载 css 内容。请帮忙。

最佳答案

在您的开发者工具上转到 -> 网络选项卡。然后选择-> CSS。重新加载页面。您将看到包含在您的 DOM 中的 css 文件列表及其状态。从这里您可以从文件加载的位置。如果未加载,您会发现它们标有 404 状态的红色。 你必须确保你使用的相对路径和 css 文件的目录是相同的位置。

关于html - 声明 &lt;!DOCTYPE html> 后网页无法加载 css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51510428/

相关文章:

html - 如何在 @page 中垂直居中 div 并打印(DomPDF 和 Laravel)

c# - 使用 asp.net 设置标题标签

javascript - Wordpress Bones 主题 CSS 和 JS 版本控制

javascript - 打开此列表时自动滚动到列表上的元素

javascript - document.querySelectorAll 与 div.style 一起不起作用

javascript - 如何使 jquery 图像在屏幕尺寸上动态替换而不是仅在刷新时替换?

css - 将大图像拟合到特定尺寸

javascript - 如何随时间动态更改html中<label>的颜色

html - HTML 中的卢比符号

CSS:复杂选择器 :parent 和 :not