CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   How to link a CSS page to my PHP script file (http://www.codingforums.com/showthread.php?t=283997)

beaverking1989 12-11-2012 09:11 PM

How to link a CSS page to my PHP script file
 
Hello guys!

I'm having problems attempting to link my CSS page to my php file. Both files are in the same folder, in addition to the other php files. The code for my php file is as follows:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="webcss.css" />
<script type="text/javascript" src="validation.js"></script>
<script type="text/javascript" src="ajax.js"></script>
</head>
<body>
<h1>Student Marks</h1>

<div id="navigation">
<button type="button" onclick="enterMarksAjaxRequest()">
Enter Marks
</button>
<button type="button" onclick="displayDataAjaxRequest()">
Display Data
</button>
</div>

<!-- This content field will be updated by various ajax calls. -->
<div id="content">
</div>

</body>
</html>


The CSS file is called webcss.css but it's not linking up and showing any changes upon loading up on the browser using apache.

Any ideas? Thanks for your time.

mlseim 12-11-2012 09:32 PM

Show us the .css file also.

Fou-Lu 12-11-2012 09:57 PM

This hasn't a thing to do with PHP.
Moving from PHP forum to HTML/CSS.

It doesn't matter of the CSS is in the same directory as the PHP file. Since you are linking it in using the <link> html tag, you must place it in the path governed by the html root since its relying entirely on the client to access this. So with the just the href="webcss.css" that would indicate that webcss.css must be located directly off of the html root which is probably your ~/public_html directory.

Edit:
Actually, without the / in front of the path, I'm not 100% sure what the client does to resolve this (absolute or relative from the html root). I'd expect still off of the html root, but the client guys can verify.

beaverking1989 12-12-2012 12:43 AM

Okay thanks for the help! Much appreciated :)


All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.