php - 为什么 css 不影响我的 PHP 页面?

标签 php html css

我正在学习 php 并遇到一些困难,我试图将 php 文件包含在另一个文件的 header 中,但 css 不起作用?

这是我的元素目录结构 Project Structure

这是我的 PHP 代码... blogpage.php

 <html lang="en">
<head>   
    <?php include 'head.php';?>

    <title>Off Canvas Template for Bootstrap</title>

</head>

我已经在 Struts-2/blogpage.php 中包含了路径

这是我的 head.php

   <!-- Bootstrap core CSS -->
  <link href="/css/bootstrap.min.css" rel="stylesheet">

  <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">

   <!-- Custom styles for this template -->
  <link href="css/offcanvas.css" rel="stylesheet">
   <link href="css/blog.css" rel="stylesheet">

最佳答案

CSS 文件夹是否位于 head.php 下?

尝试为所有链接添加斜杠:

   <!-- Bootstrap core CSS -->
  <link href="/css/bootstrap.min.css" rel="stylesheet">

  <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  <link href="/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

   <!-- Custom styles for this template -->
  <link href="/css/offcanvas.css" rel="stylesheet">
   <link href="/css/blog.css" rel="stylesheet">

您可以检查,直接添加链接,而不包括 php.ini 文件。以这种方式尝试查看链接是否有效。

关于php - 为什么 css 不影响我的 PHP 页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39944833/

相关文章:

php - Zend Framework 2 数据库测试 - 非对象上的 canCallMagicCall()

html - 包括带有 CID 的背景图像

javascript - Notepad++ 模板崩溃问题

html - CSS z-index 无法正确响应 - 子菜单隐藏在内容下方

html - 我的 float /clearfix 在桌面上工作但在手机上中断

PHP 把逗号变成 <br/>

php - Laravel 如何将组前缀参数添加到路由功能

php - 包含在变量内 - 包含但不打印变量

Javascript点击iframe内的坐标

html - 为什么我的模态不工作不显示,我想把它发送到代码后面