style.css不适用于我的网站的虚拟主机预览,但它适用于本地"offline" HTML文件



我目前正在开发自己的网站。所以我用一种样式编写了一些 HTML,.css .离线测试 - 一切都按预期工作,但是当我将其上传到我的虚拟主机并预览我的网站时,只有原始 html 可见,没有任何样式.css

我已经检查了路径并用对我来说正确的路径(从网络服务器的根目录(覆盖了它 - 它发生了一点变化,但仍然远离正确的外观。

索引的标题.html(我唯一的一页(

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title> test </title>
<link rel="icon" href="img/fav.png" type="image/x-icon">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="ionicons/css/ionicons.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<!-- main css -->
<link href="httpdocs/css/style.css" rel="stylesheet">

<!-- modernizr -->
<script src="js/modernizr.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

以及我的道路:

https://i.stack.imgur.com/6zAHe.png

结果是只描述了一些 html 文本,而不是样式的外观.css

您应该使用httpdocs中的相对路径。

所以把httpdocs/css/style.css改成./css/style.css.

相关内容

最新更新