可能是一个重复的问题,但我搜索了所有内容,都没有找到明确的答案。我的 CSS 文件未包含在我的 Bootstrap 3 代码中。
下面是每个页面顶部的标头包含文件的示例。包含是通过 PHP 完成的。
<title>Page Title</title>
<!-- METAs -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, inital-scale=1.0">
<!-- Stylesheets -->
<link href="css/bootstrap.min.css" rel = "stylesheet">
<link href="css/social-buttons.css" rel = "stylesheet">
<link href="css/font-awesome.css" rel = "stylesheet">
<link href="css/styles.css" rel = "stylesheet">
</head>
<body>
<div class = "navbar navbar-default navbar-static-top">
...
所有这些文件都来源于CSS文件,并且该文件是可访问的。我觉得一切都被正确包含。包含来自 PHP 文件而不是内联原始代码可能是问题吗?
文件夹结构(对于核心 php 项目)必须是
Main Folder
-- css
--all css files
--index.php / index.html
如果你的路径是正确的,那真的不应该是一个问题。假设您的目录是这样的:
/includes
/header.php (calls the below css files)
/css
/style.css
/bootstrap.css
/others.css
/index.php
在索引文件中,包含以下内容:
<?php include ('includes/header.php');?>
在标题中.php:
<link href="css/style.css" rel="stylesheet"> (etc, your other css files)