【发布时间】:2015-02-08 03:09:50
【问题描述】:
我有一个website。我的CSS没有被应用到它。这些文件与我在本地的文件完全相同。这些在我自己的本地主机上工作。我在我的 css 文档中使用 php,所以文件扩展名为 .php
(我的css文档)main.php:
<?php
header("Content-type: text/css; charset: utf-8");
?>
我在 main.php 中调用的索引文档:
<head>
<meta charset="utf-8">
<title>Chris Munroe</title>
<link rel = "stylesheet" href = "css/normalize.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel = "stylesheet" href = "css/main.php">
</head>
如果您点击我的关于页面,则会有另一个专门针对该页面的 css 文档。在网站上,您会看到它运行良好。这里有什么问题?你不能把php和css混在一起吗?我在 php/css 文档中使用该标题的位置是否重要?
【问题讨论】:
-
你为什么将你的css文件定义为php?
-
您应该将您的 div 引用
<div id = back0>到<div id = "back0">等等等等,而不是使用.php作为样式表。 -
如果你想将你的 css 包含在一个 php 中,你可能想看看:stackoverflow.com/questions/6315772/…
-
我在 css 中使用 php。这不是应该做的事吗?
-
FireBug 无所不知:样式表 chrismunroe.pw/css/main.php 未加载,因为其 MIME 类型“text/html”不是“text/css”。