PDA

View Full Version : XHTML with CSS issue.


As5a5sIn5
07-26-2006, 11:10 PM
Okay, let me explain the situation.

I have a XHTML Document. It has a .HTML extension. The .HTML are forced into being .PHP files (PHP files disguised with .HTML). Now the problem is the CSS will not work. Here is the code. Anyone see what I'm doing wrong?

<xhtml1.html>

<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Title</title>
<link href="vers1.css" rel="stylesheet" type="text/css" title="Version_1" />
</head>
<body>
This is a basic template for a website.
<div id="header">Let us see.</div>
</body>
</html>



<vers1.css>

body {margin: 0px; padding: 0px; background: #000000; color: #C0C0C0;}
#head{margin: 0px; padding: 0px; color: #0000FF;}
#body{margin: 0px; padding: 0px;}


:(

DELOCH
07-27-2006, 12:09 AM
Works perfectly for me

results:

bgcolor: Black
text1: Gray
text2: Gray

As5a5sIn5
07-27-2006, 03:30 AM
strange.. won't work on my computer's server or my webhost's server =[

Edit*

http://randomprojex.com/templates/xhtml1.html Does this page work view correctly? [Black BG and Gray Text]

Alex Vincent
07-27-2006, 03:58 AM
Error: The stylesheet http://randomprojex.com/templates/vers1.css was not loaded because its MIME type, "text/html", is not "text/css".
Source File: http://randomprojex.com/templates/xhtml1.html
Line: 0

This is in Firefox.

So your stylesheet isn't being served as text/css - server configuration problem.

As5a5sIn5
07-27-2006, 07:35 AM
[Me having a n00bish moment.]

So what exactly needs to be done.. is it something .htaccess or code or what?

_Aerospace_Eng_
07-27-2006, 09:23 AM
htaccess might work
AddType text/css css
however it might better to talk to your host. Others might be having the same problem. Do you have cpanel? Are you able to edit the mime types?

As5a5sIn5
07-27-2006, 06:55 PM
I believe it is because I enable PHP into my css documents. I was using a little script of mine to enable users to choose CSS colors for the website. So in the CSS documents SQL connections were made and colors were gathered from the DB. I know it's a lot to ask, but is there any work-around to have PHP enabled and CSS working for XHTML?

By the way, thanks a lot =]

Alex Vincent
07-28-2006, 09:35 AM
Well, you could do as the first characters of your CSS.php file:

<?php header("Content-type: text/css" ?>


Note I'm a little rusty with the header() command, so your mileage may vary.

As5a5sIn5
07-28-2006, 12:35 PM
You is a smart cookie :D








Thank you, sir. :)

Alex Vincent
07-29-2006, 06:17 AM
Thank you, sir. :)

It's what I'm here for. :cool: