Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-11-2012, 09:11 PM   PM User | #1
beaverking1989
New to the CF scene

 
Join Date: Nov 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
beaverking1989 is an unknown quantity at this point
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.
beaverking1989 is offline   Reply With Quote
Old 12-11-2012, 09:32 PM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,045
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
Show us the .css file also.
mlseim is offline   Reply With Quote
Old 12-11-2012, 09:57 PM   PM User | #3
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,649
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
beaverking1989 (12-12-2012)
Old 12-12-2012, 12:43 AM   PM User | #4
beaverking1989
New to the CF scene

 
Join Date: Nov 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
beaverking1989 is an unknown quantity at this point
Okay thanks for the help! Much appreciated
beaverking1989 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:36 PM.


Advertisement
Log in to turn off these ads.