0

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.

1 Answer 1

3

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"); 
Sign up to request clarification or add additional context in comments.

4 Comments

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?
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?
If you could make a .zip file or similar containing a complete test case, that would help.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.