我想将CSS添加到我的PHP索引文件中

我想将CSS添加到我的PHP索引文件中

本文介绍了我想将CSS添加到我的PHP索引文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的我是实习生,我必须完成的一个项目是重新设计我的整个部门网站。我已经学习了HTML,CSS,JavaScript,jQuery和php基础知识。我必须用PHP创建我的项目。所以在一个测试文件夹中我有一个名为index.php的文件。在这个文件中,我想创建一个标题主体和一个纯粘性页脚。我查看了许多网站的这种布局,并将代码添加到我的index.php以及我的style.css文件中,它位于同一个文件夹中。

Ok I am intern and one of my projects that I have to complete is redesign my whole departments website. I have went through and learned HTML, CSS, javascript, jQuery and php basics. I have to create my project in PHP. So in a test folder I have a file called index.php. In this file I want to create a header main body and a pure sticky footer. I looked on many websites for this layout and added the code into my index.php as well as my style.css file which is in the same folder.

当我尝试检查网站是否显示基本标题主体和页脚(我确实添加了背景颜色以查看它们是否放在正确的区域)所有它会打印出的CSS代码。这是我在index.php中的代码

When I try to check the website if basic header main body and footer were shown(I did add background colors to these to see if they were placed in the right area) all it would do is print out the CSS code. This is my code in the index.php

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Created by: Sivaram Penumarty [skpenuma] -->

<? php
         include ("style.css");
?>

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<title>WireLess Networking Group US PDE</title>
</head>

<body>

<div class="header"></div>
<div class="mainbody"></div>
<div class="footer"></div>
</body>
</html>

这是我在style.css文件中使用的代码以及我去的时候所做的一切到它应该托管的链接是将style.css文件中的所有内容打印到网页上。不管它可能是什么。它从来没有成为我希望它做的标题主体或页脚。

That is the code I had with stuff in my style.css file and all it did when I went to the link it was supposed to be hosted on was print out everything that was in the style.css file onto the webpage. whatever it might be. It never made a header mainbody or footer that I wanted it to do.

我们将非常感谢您的帮助。

Your help will be greatly appreciated.

推荐答案

CSS是CSS。如果你将它包含在 .php 文件, .html 文件等中无关紧要。在同一个文件夹中创建 style.css 文件。

CSS is CSS. Doesn't matter if you're including it in a .php file, a .html file, etc. Just make a style.css file in the same folder.

这篇关于我想将CSS添加到我的PHP索引文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 20:19