网站风格未应用。 (调用stylesheet.css从php包括) [英] Website styling not being applied. (Calling stylesheet.css from a php include)

查看:175
本文介绍了网站风格未应用。 (调用stylesheet.css从php包括)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下午好,新年快乐!
我想知道是否有人可以帮助我解决一些问题,我在使用HTML,CSS ...和PHP第一次创建一个网站。 (我之前的网页设计尝试只有在HTML和CSS)。

Good afternoon, and Happy New Year! I wonder whether anyone could help me resolve some problems I'm having in creating a website using HTML, CSS...and PHP for the first time. (My previous attempts at web design were only in HTML and CSS).

目前的问题是,我的主页( index.php )

The problem at present is that my home-page (index.php) somehow isn't 'seeing' my stylesheet.css.

代码 index.php 基本上如下:

    <?php
      $page_title='Home';
      [php-code here, to call in include1.php.....Please see below for details]
    ?>
    <div class="copy">
      [page content here, in html]
    </div>
   <?php
      [php-code here, to call in include2.php.....Please see below for details]
?>

我的文件夹结构是:
web

My folder structure is : web

   css
     stylesheet.css
   images
     logo.png
   includes
     include1.php
     include2.php
   index.php

尝试调用 include1 .php (包含doc类型声明,头部分包括对 stylesheet.css 的引用),我试过下面的c $ c><?php ?> ,如上所示),均未成功:

In attempting to call in include1.php (containing doc type declaration, and Head section including reference to stylesheet.css), I've tried the following (inserted between <?php and ?>, as shown above), all without success :

$pathtoinclude1 = $_SERVER]'DOCUMENT_ROOT'];
$pathtoinclude1 .= "/includes/include1.php";
include_once($pathtoinclude1);

include('/includes/include1.php')

include1.php ,我对 stylesheet.css 的引用是:

<link rel="stylesheet" href="../css/stylesheet.css" media="Screen" type="text/css"/>

当我预览主页时,我得到的是默认字体的文本?)。没有通过CSS的样式正在应用。

When I preview the home-page, all I get is the text in default font (Times New Roman?). None of the styling via CSS is being applied.

任何人都可以给我一些指示,我做错了,请吗?这让我有点便盆,把我抱得很糟糕。

Can anyone give me some pointers as to what I'm doing wrong, please ? This is driving me a bit potty, and holding me back badly.

任何帮助非常感谢。谢谢。

Any help much appreciated. Thank you.

推荐答案

如果第一个答案无效,请尝试替换

If that first answer doesn't work, try replacing

<link rel="stylesheet" href="../css/stylesheet.css" media="Screen" type="text/css">

<?php include'style.php'?& / code>

with <?php include 'style.php'?>

然后在style.php文件中包含< style> 然后定期添加css。

And then in the style.php file include the <style> tags and then add the css regularly.

这篇关于网站风格未应用。 (调用stylesheet.css从php包括)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆