Welcome to WebmasterWorld Guest from 54.145.166.96

Forum Moderators: not2easy

Message Too Old, No Replies

CSS in PHP

   
11:24 pm on Jan 26, 2009 (gmt 0)

5+ Year Member



hi all, I have built a page in HTML and have attached a CSS to it and have been able to preview it in different browsers and it appears to be working perfectly.

but when I tried to run it through XAMPP the result is not even remotely similar. my background images don't appear, nothing is centered as it should and basically all of my CSS formatting is just gone.

can anyone please explain to me what I need to do in order to run an HTML page with some CSS formatting through a PHP server? I've been told I only need to change the extension from .html to .php but that's not working. i'm new to PHP so I could really use some help

thanks

11:39 am on Jan 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps the web server doesn't send the right content-type header along with the stylesheet. Some browsers ignore the stylesheet if it doesn't have the right content-type. You can easily check the header with the Web Developer Toolbar for Firefox.
8:19 pm on Jan 28, 2009 (gmt 0)

10+ Year Member



As RonPK said. Particularly if you have PHP parsing enabled for .css files. If you have, adding:

<?php Header ("Content-type: text/css"); ?>

at the top of your .css file/s will fix it.

Either that or your external files links are referencing your local hard drive, which is an easy mistake to make if you're using something like Dreamweaver.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month