Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using gzip to compress my files so I need to add the following code to the top.

ob_start("ob_gzhandler");
header("content-type: text/css; charset: UTF-8");
header("cache-control: must-revalidate");
header("expires: ".gmdate('D, d M Y H:i:s', time() + 1000)." GMT"); 

The problem is now that the first line of css code in my file does not work. e.g.

body{
  color: red;
  font-weight: bold;
}

using this the text would be bold but not red.

Looking forward to an advice.

Thanks in advance.

share|improve this question

1 Answer

up vote 3 down vote accepted

Edit:

From the comments, it turned out to be because:

the php code was inserting something into the css file.

Probably either:


The font-color property does not exist.

Use color: red instead.

If the text is indeed bold, then your CSS file is working, so there shouldn't be any more problems.

Although I think the last line of your PHP should be:

header("expires: ".gmdate('D, d M Y H:i:s', time() + 1000)." GMT"); 
share|improve this answer
Well, I did edit it in the post, but that definitely was not the problem. I did use correct css when testing. It really just does not work for the first line. Removing the php code the first line works, if the code is there it does not. Any other ideas? – Lukas Oppermann May 29 '11 at 23:14
1  
I can't think of a single scenario where body{color:red;font-weight:bold} would result in "not red", bold text. If the entire selector was being ignored ("not red" and not bold) that would make sense. There's either something you're not putting in your question, or some very weird issue, like this perhaps: stackoverflow.com/questions/4944067/… Also, what happens if you do body{font-weight:bold;color:red} - do you get text that is not bold, but is red? – thirtydot May 29 '11 at 23:39
If you could make a .zip file or similar containing a complete test case, that would help. – thirtydot May 29 '11 at 23:45
Thanks dude, it was the weird issue case. Apparently the php code was inserting something into the css file. I redid the header part and it works like a blase now. thanks. If you could post this part as an answer I could check it as a correct answer. – Lukas Oppermann May 30 '11 at 6:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.